[fluent-nhib] Re: Having trouble with Dynamic components

2011-07-09 Thread Oliver Friedrich
Opening this old thread because the issue still exists with version 1.2.0.712. This mapping works wonderfully with plain old NHibernate xml mapping: Doing the *same *thing with Fluent works, but providing the property names *dynamically *throws: DynamicComponent( x =>

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread rob
So: -String.format doesn't help -declaring i at the start of the method doesn't help -i dont' have resharper installed, but I don't think the scope of i is the issue... -Yes, I agree that it has something to do w/ reflection and the way LINQ expressions are evaluated. Clearly i is being evaluated

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread James Gregory
Rob: Do you have Resharper installed by any chance? If so, does it complain about any scope issues with your i variable? On Fri, Jun 19, 2009 at 3:50 PM, Hudson Akridge wrote: > What I'm thinking is happening here, is that since linq stuff is all > deferred execution, when it's finally called, i

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread Hudson Akridge
What I'm thinking is happening here, is that since linq stuff is all deferred execution, when it's finally called, i is out of scope and doesn't exist (the null ref exception he's getting). If there's a way to force mapping() to be evaluated immediately when it's referenced on DynamicComponent, tha

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread James Gregory
I'm guessing it's something todo with the way the ReflectionHelper is working on it, so it may require a code change on our part. On Fri, Jun 19, 2009 at 3:05 PM, Hudson Akridge wrote: > Very strange. Have you tried perhaps an explicit i.ToString()? Or a > string.Format("property{0}",i)? > > > On

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread Hudson Akridge
Very strange. Have you tried perhaps an explicit i.ToString()? Or a string.Format("property{0}",i)? On Fri, Jun 19, 2009 at 8:55 AM, rob wrote: > > Doesnt' work. If I used any variable or even a hardcoded integer (as > in x["properytname" + 3]) inside the x[...] statement I get the > error. > >

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread rob
Doesnt' work. If I used any variable or even a hardcoded integer (as in x["properytname" + 3]) inside the x[...] statement I get the error. On Jun 19, 4:15 am, James Gregory wrote: > What happens if you declare a variable that contains the property name? > > for (int i = 0; i < 1; i++) > { >  

[fluent-nhib] Re: Having trouble with Dynamic components

2009-06-19 Thread James Gregory
What happens if you declare a variable that contains the property name? for (int i = 0; i < 1; i++) { var propertyName = "property" + i; c.Map(x => x[propertyName], "columname" + i); } On Fri, Jun 19, 2009 at 1:15 AM, rob wrote: > > Hi- > > I'm using the latest release (524) of Fluent and