Thanks for the reply, Hudson. I will take a look at the NHibernate docs and try and implement that. It sounds like my virtual method needs to be mapped with a readonly accessor (?) so that it doesn't go out to via nhib in outgoing DDL, but can be interpreted by the HQL parser in selects. Am I on the right track?
I was thinking that the conversion from Linq\POCO would occur first -- via an expression tree -- then, translated to HQL as the concatention of the two fields. So much to learn... and I love it. Thanks again, Kurt On Jun 16, 2:12 pm, Hudson Akridge <[email protected]> wrote: > Your question isn't specifically a fluent way that I'm aware of, you're just > looking for a way to map a model formula property to the database, for > querying, but that doesn't get read out of the database (because again, it's > calculated in the model based on the other two properties). Is that correct? > In NHibernate, look at mapping the FullName property using a: > access="NHibernate.Properties.ReadOnlyAccessor, NHibernate" > > Attribute. The ReadOnlyAccessor may be exactly what you want there. > > I don't have the source of fluent available to me right now, but I don't > believe we currently support the ReadOnlyAccessor, so you might be stuck > setting that manually with SetAttribute for now (although expect that method > to go away here soon in trunk), or you can just modify your version of FNH > to support that. > > > > On Tue, Jun 16, 2009 at 12:56 PM, kujotx <[email protected]> wrote: > > > I have a derived class that uses a method from a value object. My > > value object has first, last names, so I added a concatenation for > > full name and other variations for Find() criteria. > > > The abbreviated version is shown below. My goal is to be able to do > > something like the following p => p.Person.FullName.Contains("John > > Doe"); > > > I am using Nhibernate.Linq and Linq.Specifications. I was trying to > > write a specification that included the > > > That fails. Is there a fluent nhibernate way that I can accomplish > > this, or will the solution lie more in nhibernate? > > > Thanks, > > > Kurt > > > <code> > > public class User : AbstractUser{ > > } > > > public abstract AbstractUser > > { > > public virtual Person Person {get; private set:} > > } > > > public class Person{ > > public virtual string LastName {get; private set;} > > public virtual string FirstName {get; private set;} > > > public Person (string firstName, string lastName){ > > FirstName = firstName; > > LastName = lastName; > > } > > > public string FullName{ > > get{ > > return string.Format("{0} {1}, FirstName, > > LastName"); > > } > > } > > } > > </code> > > -- > - Hudsonhttp://www.bestguesstheory.comhttp://twitter.com/HudsonAkridge --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
