IDictionary with composite element mapping

Alessandro Di Lello's Avatar

Alessandro Di Lello

16 Apr, 2010 10:17 AM via web

Hi there,

i have these 2 classes:

public class Category
    {
        IDictionary<string, CategoryResorce> _resources;
    }

public class CategoryResource
    {
        public virtual string Name { get; set; }
        public virtual string Description { get; set; }
    }

and this is xml mapping


<generator class="identity"/>
  <key column="EntityID" />
  <index column="LangCode" type="string"/>

  <composite-element class="Aca3.Models.Resources.CategoryResource">
    <property name="Name" column="Name" />
    <property name="Description" column="Description"/>
  </composite-element>

and i'd like to write it with Fluent. I found something similar and i was trying with this code:

HasMany(x => x.Resources)

            .AsMap<string>("LangCode")
            .AsIndexedCollection<string>("LangCode", c => c.GetIndexMapping())
            .Cascade.All()
            .KeyColumn("EntityID");

but i dont know how to map the CategoryResource entity as a composite element inside the Category element.

Any advice ?

thanks

  1. Support Staff 2 Posted by James Gregory on 03 Aug, 2010 11:27 PM

    James Gregory's Avatar

    As a user of our Dictionary support, you might be interested in our rework of this feature: Dictionary mapping redesign. We're working on simplifying the syntax, while making it more flexible at the same time.

    In our new design we have a CompositeElement method which should do exactly what you need.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What month comes before July?