NHibernate Designer for mapping

Topics: Customizing Orchard, Troubleshooting, Writing modules
Dec 3, 2011 at 1:22 AM

I'm using an Nhibernate Designer Mapping tool to map to my custom tables. However, the namespace they are in does not end with .Models or .Records

How cn I get and set them in my content part?



   public ProductTemplateRecord ProductTemplate
            get { return Record.ProductTemplate; } <-- .Record (Intellisense is not giving me my model class.)

            set{ Record.ProductTemplate = value;}



Dec 3, 2011 at 1:27 AM

Either you adhere to the conventions, and you don't need a mapper and thus a mapping tool, or you don't, and you're pretty much on your own.

Dec 3, 2011 at 2:22 AM

I know. I know. I would like nothing more than to have all my clients tables adhere to Nhibernate conventions. These tables were built long ago. And I have no control over the schema.  They have primary keys and column names of whatever they named them. Will Orchard auto map to the primary key? And use that as the Identity?  Because that is what this mapping tool does. It just grabs the primary key column as says that's the identity column.

I'm not an advanced programmer. I want to learn as much as I can about MVC and Orchard. I have the all the books. But they all use different scenarios than what I'm doing. I'm just trying to make this site work for the client.


According to Sebastians post on another thread, if I understand him correctly, the model class need only be in a namespace that ends in Models or Records. Is that true? Because none of my tables have simply a column named "Id". Having a column named Id is out of the question unfortunately.

Dec 3, 2011 at 2:24 AM

If I were you, I would just bite the bullet and do plain SQL on those tables.

Dec 3, 2011 at 2:31 AM

Bite the Bullet? Where did you get that phrase? ha. Aren't you from France? : )

Dec 3, 2011 at 2:32 AM

I am. Been living in the US for 8 years though.

Dec 3, 2011 at 2:37 AM

I watched your tutorial on YouTube. On how to enlist the Orchard source code. Your voice is much more mellow than your replies to my annoying questions. ; )  But I guess you put up with this shite all day. Thanks for all your help.

Dec 3, 2011 at 2:39 AM

Sorry if I come through as a lttle harsh sometimes but yes, I answer quite a lot of questions...