tags:

views:

1649

answers:

7

I'm shopping for an ORM tool. I'm agonizing over the purchase of either CodeSmith (which is currently available at a substantial discount) versus an ORM tool.

LINQ to SQL is off my list; SubSonic 2.x is off the list (I don't want to invest in that dead end knowing that SubSonic 3.0 is coming. NHibernate seems like overkill as does LLBLGEN. I've only briefly evaluated EF but don't get quickly get a warm and fuzzy feeling from it.

Am I crazy thinking that CodeSmith is a rational alternative to off-the-shelf ORMs? Will CodeSmith pay for itself in other ways?

Please note that I am in no way related to any vendors and this isn't a cheap shot SO question just for the sake of generating product noise! I am looking for honest advice and opinions about CodeSmith as an ORM tool (with its provided, or community available) templates.

Thank you, rp

+4  A: 

Code Smith is not an ORM, it's just a code generator IDE.

You can generate a DAL using code smith based off your database but that would defeat (one of) the purposes of using an ORM which is basically that it generates the DAL dynamically so you don't have to write the code.

If you're really trying to compare the two, then maybe you might get some benefit using code smith because you would have absolute control over the code that gets generated, but I'm not sure that benefit would outweight the drawback of what could turn out to be spending months to write the code smith templates to generate a DAL based off your database.

And then you have to considering what happens when you make a change to your database, you will most likely have to run code smith and build everytime you do so. A good ORM will allow you to configure your database changes in schema, and then it will generate dynamically so you don't have to worry (as much) about making changes to the database.

matt_dev
Most people would use the netTiers template though, and never actually open CodeSmith Studio.
Gromer
Or the Plinqo template, if they want Linq-to-Sql
Rafe Lavelle
+3  A: 

I think the usage of Codesmith is viable. But you should look into frameworks that use it. Net Tiers is an application framework that can be built upon to knock out a good DAL.

Jeff Martin
+5  A: 

NHibernate is the way to go. It is an enterprise-grade ORM. And with the convention-based auto-configuration from the FluentNHibernate library, configuration is ridiculously simple if you stick to a single convention (you get to specify the conventions, or there are defaults).

With NHibernate, your domain objects are pure C# objects. No weird base classes. No codegenned files that need to get refreshed every time you decide to make a change.

Justice
You may wish to use Codesmith to generate your C# classes from your database to get you started with NHibernate
Ian Ringrose
A: 

Why would something like LLblgen be overkill ? We use it at work, and after a somewhat steep learning curve, it's very nice :). You should at least give that and nhibernate a try.

Not sure what this has to do with codesmith though, thats a codegenerator, you could roll your own ORM, but since there are already good ones out there, I dont think it's worth the time and effort unless you want to do it for learning purposes.

Morph
+5  A: 

In fact, hibernate is a good ORM tool. But it stops there!

Code smith capabilities can be more than just a relational mapping staff! I use code smith to generate some UI forms, business layers (templates), data access layers, patterns, and so on. But to work with code smith, you may need good experience with system design or use their templates which I don’t like to use but I like as an example.

Code smith approach has one special drawback; you have to design your system considering the database implementation first. Nowadays, in object analysis approach, people success in implementing business logic & entities just before any database implementation – they forget about this.

Decision is hard; I've constantly read important names such as Scott W. Ambler, Kent beck, Robert C. Martin and people from The Pragmatic Programmers series which recommends ORM Tool to speed up development. They said that ORM Tool developers are concerned with all database issues (pooling, connections, database vendor specifics, etc). So when we have to design data access layers we have to consider all these aspects too.

I believe that these ORM tools come along with an overburden. I don't know yet how these tools would behaviour in low budget projects (I mean not good hosting servers or any kind of shared resources). I’ve seen inexperienced developers not taking this into account as they try to evangelise their beloved tools. But in java projects, hibernate is already a widespread and well-known tool. I have no doubt the great projects has been delivered using this technology but I have seen anyone and again java developers may need to teach us (.net developers) how to build great solutions. (Sorry, we have to admit.)

The only thing I would recommend is to consider your context. Are you doing a new system? You need work in pattern? Have you ever try to consider such code generator and ORM tools altogether?

I do prefer code smith because I generate entire solutions at once, not just data access layer. Code generation is very important and it is not for less that Microsoft has imitated code smith approach in visual studio.net 2008 and so on.

Good luck

Eduardo Xavier
Great answer, thank you, Eduardo.
rp
+4  A: 

I use netTiers daily and love it. Documentation for it sucks, but it has been such a time saver for me at the office. A lot of people gripe about the amount of code it produces, but from what I've seen, the code it creates is a lot faster than hand coding much of it. It also generates all the sprocs you will need for your basic CRUD stuff. The access methods it produces are pretty awesome as well, getting by all your unique keys, foreign keys and primary keys.

Gromer
Thank you, Gromer. This helps.
rp
Don't forget that the NetTiers documentation is open to the community. You can always contribute! :)
CitizenBane
A: 

Go with netTiers and .netMVP. NetTiers is a very nice DAL and .netMVP is a framework I just released to support abstraction at the UI level. :)

http://community.codesmithtools.com/CodeSmith/m/templates/42499.aspx

Brian Coggin