I mean when you use LINQ, EF or TableAdapter... When you see the auto-generated codes, you will find that model classes are always mixed with CRUD mtthods. If you are using EF, you can see codes like this:
using (XXXEntityContext efc = new XXXEntityContext())
{
efc.XXXs.AddXXX(instancehere....);
}
Don't you see Insert, delete, as well as update things come from XXXEntitContext, but the model class comes from this same Namespace,too...
I think it's better to seperate them from each other.
TimoYang
Contributor
3732 Points
1275 Posts
Re: Why does Microsoft combine the logic methods with Model classes together?
Jan 02, 2012 08:06 AM|LINK
Hello again,
I mean when you use LINQ, EF or TableAdapter... When you see the auto-generated codes, you will find that model classes are always mixed with CRUD mtthods. If you are using EF, you can see codes like this:
using (XXXEntityContext efc = new XXXEntityContext())
{
efc.XXXs.AddXXX(instancehere....);
}
Don't you see Insert, delete, as well as update things come from XXXEntitContext, but the model class comes from this same Namespace,too...
I think it's better to seperate them from each other.