views:

148

answers:

7

Is 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#.

+1  A: 

Codesmith?

Daniel Mošmondor
with http://nettiers.com/
scottm
+4  A: 

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.

Dave
This tool helps to create only the entity class.. but I want to generate 4 types of classes.. Model, DAO, entity and Facade..
Pavithra Jayakumar
http://www.simple-talk.com/dotnet/.net-tools/exploring-linq,-sqlmetal-and-sqltac/ <--- Have a flick through that.
Dave
+8  A: 

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)

Kev
+2  A: 

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

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.

kmarks2
you can also use Fluent NHibernate to eliminate the need to write any xml files. fluentnhibernate.org/
czuroski
+3  A: 

Entity Framework may be a better choice.

saurabh
Sadly v4.0 is VS 2010 only.
Kev
A: 

Subsonic does what you ask. It has ActiveRecord and Repository style implementations, for your choosing.

qstarin
A: 

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...

Hassan Gulzar