I need to develop a .NET 4 application with an MS SQL Server 2008 database. There will be about 5-6 "classes." I am familiar with developing applications in Python/SqlAlchemy ORM.
Is there any simple mechanism to do the following tasks?
- create classes and their dependencies
- automatically create database tables and query classes in C#
Take a look at Entity Framework 4.1 "Code First". It lets you describe the data model in code, and as you say, then let magic happen.
For simple project you can use: SubSonic - it's easy to use with only few dlls. It has also easy learning curve.
I recommend you to check out Entity Framework. In the new version, 4.1, there is a feature called Code-First that does what you describe.
ScottGu has a great blogpost explaining it:
My preference for ORM in .NET is Entity Framework 4. It can easily create the classes from your database schema, and combined with LINQ it's a powerful combination.
You can find a link here.
You should also look at ASP.NET Dynamic Data - it works in with Entity Fx for Scaffolding even UI. Great for small data-entry applications where you don't want very specific UI.
精彩评论