I need to map the following class hierarchy using Entity Framework 4.3.
public abstract class Rule
{
public long Id {get;set;}
public abstract ICollection<Parameter> Parameters {get;set;}
}
public class Entity1
{
public long Id {get;set;}
public ICollection<Rule> Rules {get;set;}
// Map Rule to table Entity1Rules and
// Parameters to table Entity1RuleParameters
}
public class Entity2
{
public long Id {get;set;}
public ICollection<Rule> Rules {get;set;}
// Map Rule to table Entity2Rules and
// Parameters to table Entity2RuleParameters
}
Thanks
It is not possible. Each entity can be mapped only once. It would require you to involve some inheritance in
RuleandParameterclasses but at the end yourEntity1andEntity2will need to reference derived rule to set correct structure.