NHibernate : map to fields or properties?

后端 未结 7 1231
傲寒
傲寒 2021-01-02 00:55

When you create your mapping files, do you map your properties to fields or properties :



        
7条回答
  •  一向
    一向 (楼主)
    2021-01-02 01:41

    I map to properties. If I find it necessary, I map the SETTER to a field. (usually via something like "access=field.camelcase").

    This lets me have nice looking Queries, e.g. "from People Where FirstName = 'John'" instead of something like "from People Where firstName/_firstName" and also avoid setter logic when hydrating my entities.

提交回复
热议问题