Dynamic Data litle example

Posted: March 21, 2012 in .NET, Data Management

Today some developer of my company had ask about Dynamic Data usage for the creation of a backoffice, not about advantages and disadvantages but about how to do this. After asking another developers and architects inside and outside the company i figure out that dynamic data stills a mystery for a lot of people. So decided to post a cast i had upload to youtube long time ago about this subject.

I hope this helps people have an idea about how to use Dynamic Data.

Be carefull if your intend is to generate dynamic backoffices for your sites that have a lot of usability thoughts and needs and are nos sealed in time. Dynamic Data is great but is not easy to make a valid framework based on it.

But if you need and adopt this technology to doit pay attention that entities are generated by VS, so if in the feature anything changes in the database you have the need to regenerate all the entities and you can louse your customization and changes. So use the generated entities as a base from where you extend. To know how to extend in a elegant way as we do next.

Imagine you have a product table that had been used to generate the entity that represent that product, we have the need to extend the business logic of Product. To do that you take advantage of the fact that the generated class is Partial, knowing that is easy to extend the business logic. Imagine a reordering method.

public partial class Product
private short sStockLevel;
public short StockLevel
get { return sStockLevel; }
set { sStockLevel = value; }
partial void OnSafetyStockLevelChanging(short value)
StockLevel = value;
partial void OnReorderPointChanging(short value)
if (value > StockLevel)
throw new ValidationException(“Re-order Point exceeds the Safety Stock Level!”);

  1. João Pessoa says:

    What a fantastic post in 5 minutes i learn how to use the visual studio to generate access data. I had read some post and did not understand how to do this thanks Alexandre for you post and video!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s