Derik Whittaker

Syndication

News


Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
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,


Posted 01-31-2008 8:25 AM by Derik Whittaker
Filed under: , ,

[Advertisement]

Comments

Christopher Bennage wrote re: NHibernate and Automatic Properties gotcha
on 01-31-2008 10:47 AM

Good to know!

spinhio wrote re: NHibernate and Automatic Properties gotcha
on 05-09-2009 6:51 AM

Hi!

But what value should we set for the NHibernate .hbm?

thanks!

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)