开发者

What is the use case for Access.BackingField in Fluent NHibernate?

开发者 https://www.devze.com 2023-01-15 06:44 出处:网络
The documentation for Access.BackingField() indicat开发者_如何学Pythones that this: Sets the access-strategy to use the backing-field of an auto-property.

The documentation for Access.BackingField() indicat开发者_如何学Pythones that this:

Sets the access-strategy to use the backing-field of an auto-property.

I understand that auto-properties get compiled with backing fields, but if the property is by definition a vanilla getter/setter, what advantage is garnered by going to the backing field directly versus using the setter (i.e. using the FNH defaults).

The only thing I can think of is that one might want the mapping to break if someone later adds logic to the setter.

What am I missing?


Ah, I think I found the answer here.

Use the backing field if the auto-property has a private accessor.

0

精彩评论

暂无评论...
验证码 换一张
取 消