开发者_Go百科
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this questionIs there any free tool or plug-in for Visual Studio to convert the SQL tables to entity, model, facade and DAO classes? I am working on SQL Server 2008, Visual Studio 2008 and C#.
Have you tried LINQ to SQL (although the future of LINQ to SQL is a bit vague)?
If you were using Visual Studio 2010 you'd get Entity Framework tooling in the box.
There's also NHibernate which has a variety of free tooling:
Free NHibernate helper tools? (Stack Overflow)
Try using SQLMetal from Microsoft. The files aren't pretty, but they work and also provide LINQ functionality. It's also free :)
I've used it first hand, and it works very well. The beauty of it is, it generates everything from one command.
Hope this helps.
Entity Framework may be a better choice.
I'm pretty sure NHibernate is free. It's a pretty common tool for ORP. All you have to do is write some XML to map class fields to tables and you're set.
http://community.jboss.org/wiki/NHibernateforNET
I forgot to mention, another reason I like NHibernate is that is completely abstracts away the specific type of relational system you are connecting to, thus making your code more portable. I might be wrong, but I always thought that LINQ was very tightly coupled with SQL Server (M$ love lock-in) -- NHibernate gives you freedom from this in case at some point your back-end relational system is no longer SQL Server.
Codesmith?
Subsonic does what you ask. It has ActiveRecord and Repository style implementations, for your choosing.
You should give Subsonic a try. NHibernate is probably one the mature ORMs. If you are a part of an organization, you might have some of the heavy duty and expensive ORMs like the Telerik OpenAccess or DevExpress XPO. My first ORM was Adapdev Codus. Unfortunately, I have no idea why the developer hit the high road...
First, I would seriously consider using an industry standard ORM solution (Linq2SQL, EntityFramework, NHibernate, LLBL). If you still want to roll your own, I found some benefit in reading over the LinqToSQL templates themselves and modifying the code to do what I needed with t4.
精彩评论