A quick follow up to this. After further investigation I have found this 
only applies if the fields are prefixed with the same string which is 
longer than 4 characters. For example If I prefix the "Name" and "Email" 
fields with the word "Race" then it works fine. However I prefix it with 
any string longer than 4 characters e.g. "Contact" then it will give the 
same value for both properties. It looks like I over simplified my code in 
the original post.

On Wednesday, 19 April 2017 16:30:19 UTC+1, Lee Timmins wrote:
>
> I've just upgraded an application from version 3.3.4.4000 to 4.1.1.4000 
> and I have hit a major issue and I wanted to make sure this is a definite 
> bug before filing it as one. Basically I have a mechanism of adding 
> additional fields to entities and storing them in an attributes collection 
> (IDictionary). I do this programatically when I build the configuration 
> (using FluentNhibernate). However the issue I'm having is that the values 
> for each attribute is the same for each field/property. Here's a sample of 
> the code which adds the dynamic component:
>
> Fluently.Configure()
>     ...
>     .ExposeConfiguration(c => {
>         var persistentClass = c.GetClassMapping("MyApp.Models.User");
>
>         // Create the component
>         var component = new Component(persistentClass);
>
>         // Add the "Name" property
>         var simpleValue = new SimpleValue(persistentClass.Table) { 
> TypeName = "String" };
>
>         simpleValue.AddColumn(new Column("Name") {
>             Value = simpleValue,
>             Length = 100,
>             IsNullable = true
>         });
>
>         component.AddProperty(new Property() { Name = "Name", Value = 
> simpleValue });
>
>         // Add the "Email" property
>         var simpleValue2 = new SimpleValue(persistentClass.Table) { 
> TypeName = "String" };
>
>         simpleValue2.AddColumn(new Column("Email") {
>             Value = simpleValue2,
>             Length = 100,
>             IsNullable = true
>         });
>
>         component.AddProperty(new Property() { Name = "Email", Value = 
> simpleValue2 });
>
>         // Add the component
>         persistentClass.AddProperty(new Property() { Name = "Attributes", 
> Value = component });
>     })
>     .BuildConfiguration();
>
> However if I say:
>
> session.Get<User>().Attributes["Email"]
>
> It has the same value as the "Name" attribute. Looking in the database it 
> has definitely has different values.
>
> I have simplified the above to show the problem. This worked fine before. 
> Please let me know if this indeed a bug or if there is a new way of doing 
> this in version 4.
>
> Thanks
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to