Does nHibernate allow auto-creation of a class like linq in sql?
Just a basic question. Learning Linq for SQL and some nHibernate. I am using mvc tutorial and they drag tables to visual designer studio to create classes and hook everything up.
When I experimented with nHibernate, I had to do a lot with xml files. NHibernate has something "lightweight" like Linq to SQL, or is this drag and drop for Linq to SQL so basic that when I want to do something "real" it doesn't matter that Visual Studio does it for me ( at the same time the initial level)? In other words, the further I move from Linq to SQL, I will eventually have to process config files like I do with nHibernate.
a source to share
Have a look at the Lock ActiveRecord framework.It replaces the use of XML configuration files using attributes directly in the class / property declaration. Also, a tool called ActiveWriter integrates with Visual Studio and lets you connect to a data source and generate an object model!
a source to share
There is no native support, as you see with LINQ to SQL. However, there are third party add-ons that will allow you to do something similar with nHibernate. My favorite:
http://sourceforge.net/projects/nhibernateaddin
To use it:
-
Create a connection to the database containing the structure you are about to inject code (your development database).
-
Add a new NHibernate plugin element (via add a new element) to your project which will contain domain objects. In the properties window, add the data connection string from the data connection you just created (this is not automated yet).
-
Finally, you drag your tables from your connection to the NHibernate plugin object and when your mapping files are saved and you generate domain objects. Use it creates a data connection for the database containing the structure you are about to inject the code into (your development database).
a source to share