开发者

mapping entities with relations backed by obfuscated fields with NHibernate

开发者 https://www.devze.com 2023-04-13 08:25 出处:网络
And here goes yet another question on NHibernate. This one most likely doesn\'t have a desired answer, but still - let\'s give it a try.

And here goes yet another question on NHibernate. This one most likely doesn't have a desired answer, but still - let's give it a try.

I'm currently putting all the efforts into mapping a domain model onto the da开发者_C百科tabase using NHibernate. This domain model comes from a framework which is heavily obfuscated. (Not that I have worked a lot with obfuscated code before, but this one in most of the places can be translated neither by Reflector, nor by Resharper.)

Everything went more or less fine until I faced an entity with a required many-to-one relationship represented by a property with no setter with obfuscated backed field.

  1. Is it possible to reference this obfuscated field somehow? A very special IPropertyAccessor?
  2. If not, how can I load a fully constructed entity? The only option to inject a related object is by using a constructor that accepts it. But at the time of instantiating of an entity being loaded, neither IInstantiator nor IInterceptor has any data of it apart from the key. Any other extension points that suit my need?


To allow NHibernate to access your field instead of property you can use this in your mappings:

access="field"
0

精彩评论

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

关注公众号