twk
twk

Reputation: 3120

Database tables to C# entity classes - generator for FluentNHibernate?

I am planning to use NHibernate for my next project with mapping through FluentNHibernate. I have a database already, so I have to generate C# classes for entities mapped to database tables.

What tool would you recommend (if there is any?) for automatic C# class generation for NH from MS SQL database?

Thanks for sharing.

Upvotes: 1

Views: 3416

Answers (3)

Alun Harford
Alun Harford

Reputation: 3124

Don't.

The whole point of object-relational mapping is to... well... map.

If you generate the classes from the database you may as well be using typed datasets.

Think about what you would want your classes to look like in the object world and then use NHibernate to map that to your database schema.

Upvotes: 2

Christian C. Salvadó
Christian C. Salvadó

Reputation: 827178

Check Castle Project ActiveRecord.

Upvotes: 1

Manu
Manu

Reputation: 29143

NConstruct Lite will generate the classes and the hbm mapping files for free even though it does not support fluent NHibernate, nor does it make use of some of the new C# 3.0 features.

Upvotes: 2

Related Questions