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 an xml mapping
<class name="Category" table="Categories"> <id name="ID"> <generator class="identity"/> </id> <map name="Resources" table="CategoriesResources" lazy="false"> <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> </map> </class>
and I would like to write it with Fluent. I found something similar, and I tried using this code:
HasMany(x => x.Resources) .AsMap<string>("LangCode") .AsIndexedCollection<string>("LangCode", c => c.GetIndexMapping()) .Cascade.All() .KeyColumn("EntityID");
but I donβt know how to match the CategoryResource object as an integral element inside the Category element.
Any tips?
thanks
source share