none
Design problem for a "partner" structure RRS feed

  • Question

  • Hello everybody!

    I have a problem with the entity framework for the following structure. 

    The basic idea is to solve the problem of various types of partners related to a buissines structure (ex. an hotel). Partners could be phisical persons (Bill Gates) oder legal persons (Microsoft Inc.). 

    The following structure is what we want ideally - making use of interfaces:

    public class Partner { public int Id { get; set; } public IJuridicalUnit ReferenceJuridicalUnit { get; set; } } public interface IJuridicalUnit { int Id { get; set; } string Name { get; } } public class Person : IJuridicalUnit { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Name => string.Format("{0} {1}", FirstName, LastName); } public class Company : IOrganisationalUnit, IJuridicalUnit { public int Id { get; set; } public string CompanyName { get; set; } public JuridicalForm JuridicalForm { get; set; }

            public string LDAP_Referecence { get; set; } public string Name => CompanyName; } public class JuridicalForm { public int Id { get; set; } public string Name { get; set; } } public class Role : IOrganisationalUnit { public int Id { get; set; } public string LDAP_Referecence { get; set; } }

    It seems to me that there is no straight forward solution to integrate this into ef6. Right ?

    What are your suggestions ?

    Thanks a lot for any idea !

    Best regards, 

    Fabianus

    Thursday, March 3, 2016 2:13 PM

Answers

All replies