Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Generate C# entities from existing DB and Fluent NHibernate auto mapping

I'm working with an existing database that uses some really ugly conventions. I'd like to use NHibernate, and I think I can fix all these ugly DB conventions using Fluent NHibernate's auto mapping conventions. I'd like to avoid writing all the entity classes by hand. (This is where LINQ to SQL and SubSonic are appealing)

Is it possible to generate my C# entities based on my database schema and mappings specified in Fluent NHibernate?

Aside: Do you know of a designer for NHibernate?

like image 987
Lance Fisher Avatar asked Dec 11 '09 03:12

Lance Fisher


People also ask

What is C Code generation?

Code generation from the Wolfram Language involves converting programs written in the Wolfram Language into other languages and then supporting them so that they can be executed. The Wolfram System compiler provides a system for code generation into the C language.

Can MATLAB generate C Code?

MATLAB Coder generates readable and portable C code from your MATLAB algorithms. This automated approach speeds up your design workflow and eliminates coding errors introduced by a manual translation process.

Can Simulink generate C Code?

Simulink® Coder™ generates standalone C and C++ code from Simulink models for deployment in a wide variety of applications. For a list of DSP System Toolbox™ features supported by Simulink Coder, see Blocks Supported for C Code Generation.

Is MATLAB Coder free?

Use any C/C++ compiler to compile and run your generated code on any hardware, from desktop systems to mobile devices to embedded hardware. The generated code is royalty-free—deploy it in commercial applications to your customers at no charge.


3 Answers

I think, this is what you want: NHibernate Mapping Generator. http://nmg.codeplex.com/

like image 122
meridian Avatar answered Sep 22 '22 10:09

meridian


NHibernate Mapping Generator supports Fluent NHibernate and a variety of databases. There are also plans to support the new NH 3.2 style fluent mappings.

Have a look.

like image 38
Ravi Ranjan Avatar answered Sep 19 '22 10:09

Ravi Ranjan


LLBLGenPro V3 will work as a generic designer for a number of ORM frameworks, including LLBLGen's own framework, NHibernate,Linq2SQL and the Entity Framework.

It also includes template for generating code and mappings for all of the above frameworks.

Fluent NHibernate is under consideration at the moment :-)

like image 41
Matt Avatar answered Sep 20 '22 10:09

Matt