问题
What is the best way to learn data access in .net? The Entity Framework seems to be the new "it" thing, but what other options do I have?
Thanks,
Robert
回答1:
Your starting point is ADO.NET, with documentation available at :http://msdn.microsoft.com/en-us/library/e80y5yhx(v=vs.80).aspx .
The two most current Microsoft libraries that are based on ADO.NET are LINQ to SQL and the Entity Framework. They are maintained by Microsoft.
NHibernate is a very commonly used and highly recommended open-source ORM and persistence framework. Documentation and resources are available from : http://nhforge.org/ .
SubSonic is a "Super High-fidelity Batman Utility Belt that works up your Data Access (using Linq in 3.0), throws in some much-needed utility functions, and generally speeds along your dev cycle". It is open source with a GitHub page at https://github.com/subsonic/SubSonic-3.0.
There are many other ORMs as well, but these are the most commonly used open source relational database solutions. Wikipedia has a pretty extensive list of .NET ORM software at http://en.wikipedia.org/wiki/List_of_object-relational_mapping_software#.NET.
ADO.NET includes the fundamental objects behind Data Access in the .NET Framework. LINQ to SQL is probably the most simple ORM to learn and use, but it will always be easier if you understand what is happening underneath. The Entity Framework is similar to LINQ to SQL but includes much more functionality and aims at a more domain-driven approach, where as LINQ to SQL is more of an Active Record pattern.
回答2:
My new favorite is Massive It's a small lightweight db abstraction that uses the ExpandoObject class and SQL.
"A small, happy, data access tool that will love you forever"
回答3:
Have a look at these:
http://www.nhibernate.com/
http://msdn.microsoft.com/en-us/library/Ee817654%28pandp.10%29.aspx
http://msdn.microsoft.com/en-us/library/ff632023.aspx
[]
's
回答4:
I personally like Dapper.NET. It's a very lightweight ORM (mostly handles mapping types and dynamically populating classes from the DB). It's also part of Stack Overflow's dev stack.
来源:https://stackoverflow.com/questions/5333951/net-data-access