Archive for the ‘Data Management’ Category

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!”);
}
}
}