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 <[email protected]>wrote:

> 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 <[email protected]> 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.
>>
>> On Jun 19, 4:15 am, James Gregory <[email protected]> wrote:
>> > 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 <[email protected]> wrote:
>> >
>> > > Hi-
>> >
>> > > I'm using the latest release (524) of Fluent and am running into an
>> > > issue. I have a class that contains some regular properties and an
>> > > IDictionary property (for the dynamic component). My hope is to
>> > > dynamically build the column and property names in the fluent map for
>> > > the dynamic component using a loop. Here's what I have:
>> > > When I run this, I get the follwing exception "Object reference not
>> > > set to an instance of an object." Basically, it doensn't like having a
>> > > variable inside the dictionary key object. If I change it to x
>> > > ["property"] ti works fine. And it doesnt' complain about "columnname"
>> > > + i. Any ideas? workarounds?  Thanks..
>> >
>> > > public class TestMap: ClassMap<TestMap>
>> > >    {
>> >
>> > >        private Action<DynamicComponentPart<IDictionary>> mapping()
>> > >        {
>> >
>> > >            return c =>
>> > >             {
>> > >                 for (int i = 0; i < 1; i++)
>> > >                 {
>> > >                     c.Map(x => x["property" + i], "columname" + i);
>> > >                 }
>> > >             };
>> > >        }
>> >
>> > >        public TestMap()
>> > >        {
>> > >            Id(x => x.Id);
>> > >            Map(x => x.Gender).WithLengthOf(1);
>> > >            this.DynamicComponent(x => x.DynamicProperties, mapping
>> > > ());
>> > >        }
>> > >    }
>>
>>
>
>
> --
> - Hudson
> http://www.bestguesstheory.com
> http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to