I can't live with the idea that we need to rec开发者_StackOverflowreate the insert/update/delete functionality in ALL pocos/bl objects? EF and linq2sql that have this so nice built in by itself.
How do you guys solve this on a effective way? Using a base class or some magic in the IQueryable pocos?
.NET 4
Since your Entity Framework / Linq objects are probably inherited from some base class you can inherit the objects in your business layer from a single base class. Then do something like this:
public class BusinessBaseCollection
{
protected EFBaseCollection _efObject = null;
public BusinessBaseCollection(EFBaseCollection efObject)
{
_efObject = efObject;
}
public Add(BusinessBase obj)
{
_efObject.Add(obj);
}
//Add other CRUD stuff here
}
精彩评论