I have a LanguageMap object which contains a dictionary to map a language code to it's value. This object is used in many any object that needs to have multiple languages. Therefore it is referenced throughout my data model.
public class LanguageMap
{
public virtual Guid Id { get; set; }
public virtual IDictionary<String, String> Map { get; set; }
public LanguageMap()
{
Map = new Dictionary<string, string>();
}
}
My mapping is as follows:
public class LanguageMapMapping : ClassMap<LanguageMap>
{
public LanguageMapMapping()
{
Id(x => x.Id);
HasMany(x => x.Map)
.Table("LanguageMapMap")
.AsMap<string>("LanguageKey")
.Element("value")
.Cascade.All().Cascade.AllDeleteOrphan();
}
}
On all the classes that have a LanguageMap property (e.g. public virtual LanguageMap Details{ get; set; }
), the mapping for that property is:
References(x => x.Details)
For some reason this always creates an extra table in the database:
The LanguageMap table is unnecessary and just adds extra joins for no reason.
Any idea how to fix the mappings?