I have a class referencing a (template)text which has for each tenant and each use case several possible texts
class Class1
{
[...]
public virtual Text TitleName { get; set; }
}
class Text
{
public virtual int TenantId { get; set; }
public virtual string Key { get; set; }
public virtual int Number { get; set; }
public virtual string Value { get; set; }
}
Unfortunatly the tablestructure looks like
Table Class1
...
textnumber int,
Table Text
tenant int,
key varchar (10),
number int,
pkey(tenant, key, number);
because Class1 always refers to tenant = 0 (all tenants) and key = “class1text”
Edit:
i need .Where() but References() doenst have it only HasMany()
What i have so far:
public void TextMap : ClassMap<Text>
{
public TextMap()
{
Table("restexts");
CompositeId()
.KeyProperty(t => t.TenantId, "tenant")
.KeyProperty(t => t.Key, "name")
.KeyProperty(t => t.Number, "number");
Map(t => t.Value, "content");
}
}
public void Class1Map : ClassMap<Class1>
{
public TextMap()
{
// mapping rest
References(c => c.TitleName)
.Columns("textnumber", ??, ??); // column 2 and 3 missing, because always the same
}
}
Any Ideas?
running out of time i mapped it like
Map(c => c.TitleNameId, "textnumber");and have to remember the tenant and key name everytime i need the titlename (which is using magic values 🙁