I tried different ways to map an entity as one-to-one
and one-to-many
at the same time, but I had no luck.
I provided my models here:
public class Office
{
public virtual Person Manager {get; set;}
public virtual List<Person> People {get; set;}
}
public class Person
{
public virtual Office Office{get;set;}
}
Could anybody guide me to write mapping via fluent api?
It's not necessary to define two different mapping for specific entities. All I need was to map a
one-to-many
relation via fluent api.Here are the changes:
And by using fluent api: