Hi Dion,

thanks for your post, but it doesn't work for me out of the box.

public Customer()
{
  Settings = new Dictionary(); // it is necessary to specify type for key and 
value
}

In this way I specify an enumeration for the key 

    public enum SettingType
    {
        PrivateSetting,
        PublicSetting
    }

and a class for the value
    public class Setting
    {
        public virtual string Setting1 { get; set; }

        public virtual int Setting2 { get; set; }
    }

At the end I modify the constructor

        public Customer()
        {
            Settings = new Dictionary<SettingType, Setting>();
        }


Now the question: how to map this? I try out several solutions i found in 
groups, blogs etc.

HasMany<Dictionary<SettingType, Setting>>(x => x.Settings).AsEntityMap();

HasMany(x => x.Settings)
    .Component(c =>
    {
        c.Map(x => x.Setting1);
        c.Map(x => x.Setting2);
    });

HasMany<Setting>(x => x.Settings)
    .AsEntityMap()
    .Not.LazyLoad()
    .Inverse()
    .Cascade.AllDeleteOrphan();


Have you got an hint to help me?

Thanks 
nordside


Am Donnerstag, 31. Mai 2012 18:00:52 UTC+2 schrieb Dion:
>
> I wrote a blog post on it:
>
>
> http://dionscher.wordpress.com/how-to-map-a-nhibernate-map-tag-in-fluentnhibernate/
>
> Hope it helps.
> On May 31, 2012 11:47 AM, <fluent-nhibernate@googlegroups.com> wrote:
>
>>   Today's Topic Summary
>>
>> Group: http://groups.google.com/group/fluent-nhibernate/topics
>>
>>    - Mapping Dictionary<int, 
>> MyObject><#CAHxouQAC3Q7cs3axv+Jv6GKJCt5RiES9MtzL0dAf2jJ3JO+K4A@mail.gmail.com_137a24b35988d5fb_group_thread_0>[1
>>  Update] 
>>
>>   Mapping Dictionary<int, 
>> MyObject><http://groups.google.com/group/fluent-nhibernate/t/17ed01684f1a74ad>
>>
>>    
>>    Hi,
>>     
>>    I found some information to map a dictionary in FNH - but nothings 
>>    works 
>>    for me. With this configuration I receive an "Could not determine 
>>    type for: 
>>    MyObject, ConsoleApplication1, Version=1.0.0.0, Culture=neutral, 
>>    PublicKeyToken=null, for columns: NHibernate.Mapping.Column(Id)" 
>>    exception:
>>     
>>    I use 
>>    FluentNHibernate - 1.3.0.727
>>    NHibernate - 3.3.0.4000
>>     
>>    public class MyObject
>>    {
>>    public virtual int Id { get; set; }
>>     
>>    public virtual string PropertyString { get; set; }
>>    }
>>     
>>     
>>    public class MyObjectMap : ClassMap<MyObject>
>>    {
>>    public MyObjectMap()
>>    {
>>    Id(x => x.Id);
>>    Map(x => x.PropertyString);
>>    }
>>    }
>>     
>>    public class BigObject
>>    {
>>    public virtual int Id { get; set; }
>>     
>>    public virtual string Name { get; set; }
>>     
>>    public virtual Dictionary<int, MyObject> DicMyObject { get; set; }
>>    }
>>     
>>     
>>    public class BigObjectMap : ClassMap<BigObject>
>>    {
>>    public BigObjectMap()
>>    {
>>    Id(x => x.Id);
>>    Map(x => x.Name);
>>     
>>    HasMany(x => x.DicMyObject)
>>    .AsMap<MyObject>(
>>    index => index.Column("key").Type<int>(),
>>    element => element.Column("Id").Type<MyObject>())
>>    .Inverse()
>>    .Not.LazyLoad().Table("mybigobjects");
>>    }
>>    }
>>     
>>     
>>    I hope someone has an idea. 
>>    Thanks
>>    nordside
>>    
>>     
>>    
>>  You received this message because you are subscribed to the Google 
>> Group fluent-nhibernate.
>> You can post via email <fluent-nhibernate@googlegroups.com>.
>> To unsubscribe from this group, 
>> send<fluent-nhibernate+unsubscr...@googlegroups.com>an empty message.
>> For more options, 
>> visit<http://groups.google.com/group/fluent-nhibernate/topics>this group.
>>  
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Fluent NHibernate" group.
>> To post to this group, send email to fluent-nhibernate@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> fluent-nhibernate+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/fluent-nhibernate?hl=en.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/fluent-nhibernate/-/yX2RmFCbUuQJ.
To post to this group, send email to fluent-nhibernate@googlegroups.com.
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en.

Reply via email to