tags:

views:

340

answers:

6

Hi,

Just getting into nhibenate.

Will it generate wrappers for my stored procedures?

I am trying out constructs product, not sure if there are others out there that might be better?

+1  A: 

nHibernate doesn't generate anything, it is not a code generator. You can talk to stored procedures using nHibernate but you will have to write the mapping yourself.

Craig
A: 

Gonna get flagged for this one...sigh

If all you want is a wrapper for stored procs, and you are using SQL Server, you might consider using LINQ to SQL or Entity Framework. It would probably be less work for you. Typically it is just a drag-drop operation and everything is mapped for you.

Otherwise, what Craig said it (mostly) true. You have to create the hbm mappings for the sproc yourself.

Chris Brandsma
Stay away from Entity Framework if you can... NHibernate is flexible solution while EF is half baked. *This is may personal opinion (I am worked with EF in production project and it is my biggest mistake ever!).
Darius Kucinskas
+2  A: 

There are many code generators that will create NHibernate mappings and the classes from the Datamodel. Not sure of any that would generate an SP signature though. If the SPs all follow the same structure then you could create your own template and generate code from that - try MyGeneration.

MrTelly
adding to MrTelly's, there are two templates that you can use: 1) l99_nhibernate.csgen, 2) NHibernate.Mapping.csgenboth can only generate from tables and view. Your best bet: create a view
Syd
+1  A: 

NHibernate is a Object-relational mapping (ORM) library. It is configured via XML or you can use Fluent-NHibernate which uses code to configure the mapping.

NHibernate is not a code generator. A good code generator is CodeSmith or LLGLGen Pro. if you are an advanced programmer you can use the T4 templates that are in Visual Studio 2008.

Gary
+1  A: 

As far as i understand - Fluent-NHibernate does not support stored procedures. That means - you will have to add these maps manually in xml.

And be cautious with Linq To Entities Framework. For me it mapped only headache. :/

Arnis L.