views:

11

answers:

1

Whilst playing around with an nhibernate mapping, I noticed that a property setter I had was being overloaded (or ignored). This is expected default behaviour with an nhibernate mapping.

So I changed it to use the field.camelCase - so NHibernate would set the private field of the entity class and not the propety getter/setter so I could then use the getter to implement

get { return (new TextInfo()).ToTitleCase(_property);}

I noticed that the output was still what was persisted and this method did not work.

I changed the to _property.ToLower(); and the output was expected as lower case text.

So it appears that there is something I have not done quite right with TextInfo. NHibernate was working correctly (NB NHibernate rocks)

Any ideas why TextInfo is doing this? Probably something trivial I have missed..

+1  A: 

For some reason it doesn't work with upper-case strings, uhmmmm Microsoft ;P

Your solution will be to lower case the input first:

get { return (new TextInfo()).ToTitleCase(_property.ToLower());}
Kamileon
Cheers for that I gave it a try and it works!
Aim Kai