nhibernate / fluent-nhibernate

Fluent NHibernate!
BSD 3-Clause "New" or "Revised" License
1.66k stars 687 forks source link

Use the MemberAccessResolver for properties mapped with a CompontentMap #101

Open cremor opened 13 years ago

cremor commented 13 years ago

Currently the MemberAccessResolver isn't used for component properties mapped with a ComponentMap. Additionally there is no way to use the Access object which is returned from the MemberAccessResolver to specify the access strategy in a convention (the access strategy can only be specified with the fluent methods).

Either one of this two ways should be possible, preferably the first (MemberAccessResolver).

Trinition commented 11 years ago

I've recently run into this limitation and would like to see this implemented.

chester89 commented 11 years ago

please provides API examples of what you mean

chester89 commented 11 years ago

I think I got it - there's no way in ComponentMap to do: Map(x => x.Name).Access.BackingField(), for example. I'm not sure it's just an API that's missing. Need to dig further.

chester89 commented 11 years ago

ok, I think I'm finally ready to answer this properly. The reason I think that there are currently no way to configure how component members should be accessed is that in current version of Fluent, mapping components with fields, not properties, does not work. I can't say at the moment what's the problem - is it NHibernate, or Fluent, or both - but if you configure fields inside your ComponentMap derived class, - I did it using Member.Reveal - NHibernate will throw an exception at you about invalid mapping configuration. I will contact guys from NH team and ask them if that scenario is supported, and if it is - I'll do my best to extend an API to get this to work. So, when I get a meaningful info, I'll get back to this.