I do agree that query-only properties should be supported in mapping-by-code
(they *are* useful)
However, this is an implementation limitation
(check PropertyContainerCustomizer).
It's currently not supported (wanna create a patch?), so you'll have to
either use XML for this, or create a member (it doesn't even have to be
public) so the mapper will accept it.
Diego
On Sun, Jul 10, 2011 at 06:35, Ricardo Peres <[email protected]> wrote:
> Hi, Julian!
>
> I noticed the property name, too, but I assumed that mapping by code
> would support all of NHibernate's functionalities; since we only have
> two methods for specifying a mapping property, and since we cannot use
> the one that takes an expression (because it doesn't exist), it leaves
> us with only the method that takes the property's name.
> So I guess it isn't supported. Now the question is: are query-only
> properties ever going to be supported, or is this just an arcane
> feature that no longer makes sense? And, by the way, what is
> Accessor.None for?
>
> Thanks!
>
> RP
>
> PS - I usually use the NHUsers mailing list, but sometimes I think
> NHibernate-Development is more appropriate, sorry if you don't think
> so.
>
> On 10 Jul, 04:55, Julian Maughan <[email protected]> wrote:
> > I suspect the short answer is 'no, you can't do this'.
> >
> > There doesn't appear to be another overload of the Set method that would
> > allow a mapping where no class field/property exists.The name of the
> string
> > parameter - the one Fabio refers to - is 'notVisiblePropertyOrFieldName'.
> > You are passing it the value of "LastWeekOrders" which is not an actual
> > field/property on the class you are mapping - hence the MappingException.
> >
> > I personally like to keep query/filter semantics out of mappings. Queries
> > should be used for querying.
>