Mohamed, thank you! You forced me to re-examing my assumptions and I
think my problem is a bad override of IsPersistentProperty, which then
messed things up down the line.

Much appreciated!
-Michael

On May 31, 5:28 pm, Mohamed Meligy <[email protected]> wrote:
> If you want to know how to override it anyway, look at this sample code.
> It's not very correct, copied from another message in this list and slightly
> modifed to be related to your scenario. You'll still need to play with it to
> do what you want correctly but it show the way in general:
>
> mapper.BeforeMapProperty +=
>     (modelInspector, member, map) =>
>         {
>             map.Column("[" + member.ToColumnName().TrimStart('_') + "]");
>         };
>
> But again, I do not think you should be getting the original behavior in the
> first place. At least not with the latest NH 3.2 package on NuGet
>
> *Mohamed Meligy
> *Readify | Senior Developer
>
> M:+61 451 835006 | W: readify.net
> [image: Description: Description: Description: Description:
> rss_16]<http://gurustop.net>
> [image: Description: Description: Description: Description:
> cid:[email protected]]
> <http://www.linkedin.com/in/meligy>  [image:
> Description: Description: Description: Description:
> cid:[email protected]] <http://twitter.com/meligy>
>  <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10>
>
> On Wed, Jun 1, 2011 at 10:18 AM, Mohamed Meligy <[email protected]>wrote:
>
>
>
> > I added the property you are talking about to some test I have using this
> > mapper from NH 3.2 from the latest NH 3.2 NuGet package.
>
> > It doesn't happen in it.
>
> > First, your code doesn't compile, because the field is bool and property is
> > string.
> > I tried calling .ToString inside the getter of the property once and
> > changing the type of the property to bool another time and changing the type
> > of the field to string a third time.
>
> > In all cases it used the casing of the property not the field.
>
> > *Mohamed Meligy
> > *Readify | Senior Developer
>
> > M:+61 451 835006 | W: readify.net
> > [image: Description: Description: Description: Description: 
> > rss_16]<http://gurustop.net>
> > [image: Description: Description: Description: Description:
> > cid:[email protected]] <http://www.linkedin.com/in/meligy>  
> > [image:
> > Description: Description: Description: Description:
> > cid:[email protected]] <http://twitter.com/meligy>
> >  <http://www.greatplacetowork.com.au/best/best-companies-australia.php><http://www.readify.net/AboutUs/NewsItem.aspx?id=10>
>
> > On Wed, Jun 1, 2011 at 9:28 AM, Michael Teper 
> > <[email protected]>wrote:
>
> >> Given the class below, I would expect the ConventionModelMapper to map
> >> the IsHungry property to "IsHungry" column in the database.
> >> Unfortunately, it opts for "_isHungry" instead. Personally, I think
> >> that's a bug, but I realize that not everyone will agree, so what I'd
> >> really like to know is where can I override this?
>
> >> public class Person
> >> {
> >>  private bool _isHungry;
>
> >>  public string IsHungry
> >>  {
> >>    get { return _isHungry; }
> >>  }
>
> >>  public Person()
> >>  {
> >>    _isHungry = true;
> >>  }
> >> }
>
> >> Thank you!!
> >> -Michael
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "nhusers" group.
> >> To post to this group, send email to [email protected].
> >> To unsubscribe from this group, send email to
> >> [email protected].
> >> For more options, visit this group at
> >>http://groups.google.com/group/nhusers?hl=en.- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to