[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread Colin Jack
Na its grand, my fault. It just didn't give me any compile-time errors and I thought it looked sensible so whilst I probably should have thought of slapping a Map around it I didn't. Its funny with the nested closure stuff too, you get a lot of (< and all that for your buck which can make it diff

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread James Gregory
Maybe I should've given a fuller example for reveal, but all it does is "reveal" a private/protected property; you still have to pass that property to a mapping method. On Wed, Jan 21, 2009 at 1:14 PM, Colin Jack wrote: > > Yeah I'd read that one just hadn't copped on to the Reveal also > needin

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread Colin Jack
Yeah I'd read that one just hadn't copped on to the Reveal also needing to be passed to a Map. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nh

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread James Gregory
There are a fair few examples out there, even one specifically relating to components (first result for "fluent nhibernate components") http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/08/13/a-fluent-interface-to-nhibernate---part-2---value.aspx On Wed, Jan 21, 2009 at 12:40 PM, Colin

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread Colin Jack
You could be right on the fluent interface, my attempts in my own apps have resulted in APIs that are nice to use but a pain to write (lots of adapter/decorator code and the rest). Guess if there are more examples then the whole closure approach would be clearer, I was just expecting Fluent NHiber

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread James Gregory
We use the nested closure because doing it the way you suggested is too complicated when you start getting into specifics, we've been there. When you start specifying multiple properties, with collections, and access strategies, the method chaining falls apart. If your component only has one proper

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread Colin Jack
Ahh ok excellent thanks, and thanks for getting back to me so quickly. Wondering if this is a place where the fluent interface could lead you in the right direction: map.Component(x => x.Email).WithProperty("Value")); map.Component(x => x.Email).WithProperty(x=> x.Value)); // if not protected D

[fluent-nhib] Re: Mapping Components Containing Protected Properties

2009-01-21 Thread James Gregory
Your component mapping looks a bit wrong. It should be more like: model.ForTypesThatDeriveFrom(map => { map.Component(x => x.Email, c => c.Map(Reveal.Property("Value"))); }); You were missing out a call to Map, so the property wouldn't ever