Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Derik Whittaker

Thoughts on Software Development, .Net, OOP, Design Patterns and all things cool



NHibernate and Automatic Properties gotcha

Just an FYI. 

If you are using NHibernate and have objects that are using the new Automatic Properties feature of .Net 3.5 make sure that your NHibernate .hbm file does not have 'default-access="field.camelcase-underscore"' in the hibernate-mapping node.

If you have this attribute set you will get a run-time error while using NHibernate.  The error is NHibernate.PropertyNotFoundException: Could not find field '_fieldNameHere' in class 'ClassNameHere'

Hope this helps someone else. I know I spent about 10 minutes trying to figure out what I did wrong.

Till next time,



Comments

Christopher Bennage said:

Good to know!

# January 31, 2008 10:47 AM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Derik Whittaker

Derik is a .Net Developer/Architect specializing in WinForms working out the northern suburbs of Chicago. He is also believer and advocate for Agile development including SCRUM, TDD, CI, etc.

When Derik is not writing code he can be found spending time with his wife and young son, climbing on his bouldering wall, watching sports (mostly baseball), and generally vegging out. Check out Devlicio.us!

Our Sponsors

Proudly Partnered With


This Blog

Syndication

News