in cakephp I can setup models that are linked together. For example I can have a database with related tables as follows,
Table:Peoples (id, name, owesMeMoneyFlag)
Table:Cars(id,people_id, brand, color).I can then code
$person = Peoples::findByName("theTod");
// this will only grab the cars that belond to "theTod"
// the join is done automatically
$cars = $person->Cars->find('All');
// this will only grab the blue cars that belong to "theTod"
// findByColor me开发者_如何学Gothod is made automatically
$cars = $person->Cars->findByColor("blue");
My question is: Is there anything like this in .NET (I would be using ASP MVC3 C#)? If there is also intellisense support that would be neat.
You are looking for an ORM. There are plenty around: NHibernate, Entity Framework, Linq 2 Sql to name a few. There are also some questions on SO discussing this: What is your favorite ORM for .NET? plus duplicate links.
Entity framework (EF 4.0) with Linq.
You are looking for an ORM. The ones I have worked with that will do that are EF, NHibernate, Linq to SQL, and Subsonic. There are many more, but are not worth mentioning IMHO. If you cant use the first 3, something has gone wrong.
精彩评论