Ask a questionAsk a question
 

AnswerComplex Entity with fields from two or more tables.

  • Wednesday, November 04, 2009 4:03 PMAravind Cheziyan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    Hi,

    Am evaluating Entity Framework 4.0 for certain requirements of my project. I have following queries on the same.

    1) Is there anyway I can create a Custom Entity which can hold fields of two or more different tables? I tried doing this but seems to get compile errors.

    2) Can the Custom Entity be directly created from the designer? I tried this but there seems to be a lot of mapping errors.

    3) I want to construct a Custom Entity in which one of the property should contain a list of other child tables records. For example :

    I have a employee table(Employee) and the address about the employee is stored is a child table(EmployeeAddress) . Each employee can have one or more records in the address table. It's a one to many relationship table(1...*) .

    So I want to have a single entity holding a employee details along with his all address details in a property similary to the one given below.

    Class Entity
    {

    private long EmpID;
    Private string EmpName;
    Private List<Address> Address=new List<Address>

    }


    Please advice/share if any of you guys came across the things I mentioned above.

    Thanks,
    Arvind

Answers

All Replies