none
Relationship(inheritance , association) between 2 deferent entity models RRS feed

  • Question

  • hi,

    I had a base Entity Model that i use in multiple projects , its contained in a class library , and i add a refrance to that calss library in each project .

    each project will add new entities and relation to the base model ,

    My question is: if i created a special model for each project , that i add the new entity for that project , how can i make association , inheritance, from the project model to that base model ?


    • Edited by Hani Safa Friday, December 7, 2012 10:53 AM
    Friday, December 7, 2012 10:49 AM

Answers

  • Hi Hanisafa,

    Since you are using Model First, you have the edmx file in your dll project. Then you reference this dll. How can you add a scalar property to the entities, because you cannot see the edmx file and designer. If you want to use code inheritance, I do not recommend you use Model First approach and Code First approach simultaneously. Do you want to generate the new database in new project?

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Hani Safa Saturday, June 15, 2013 8:29 PM
    Sunday, December 16, 2012 7:41 AM

All replies

  • Hi Hanisafa,

    Welcome to the MSDN forum.

    First, are you use Code First approach?

    Second, I am not sure what address is. In the base model, I only find country and city entities. If you want to create an association with an entity in base model from child model, I think, it is not possible. Since the entities in base model do not have the corresponding navigation properties for new entities.

    Have a nice day.


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 10, 2012 6:32 AM
  • thanks for your time, I'm using model first approach. the base model is a set of entities and relations that i could use in every new project , but, every new project must add new entities and connect to existing ones from the base model. the country is an entity the has some files ,phone code , area measurement,flag ,... city is an entity that is related to country , it has phone code ,.... now these 2 entities can be used in 2 deferent applications : project 1 is application that handle some person info , that person has an address with has a country .. project 2 handle shipment , shipments has sender and receiver address , with in tern has country -> city my question is: can the base model entires (country and city) be in a separate , common file , so if i need to add ,let say , a scaler property for city (main post office location) i don it in one place instead of going to the 2 project. hope i managed to explain my point
    Tuesday, December 11, 2012 3:00 PM
  • Hi Hanisafa,

    Since you are using Model First, you have the edmx file in your dll project. Then you reference this dll. How can you add a scalar property to the entities, because you cannot see the edmx file and designer. If you want to use code inheritance, I do not recommend you use Model First approach and Code First approach simultaneously. Do you want to generate the new database in new project?

    Best Regards,


    Alexander Sun [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Hani Safa Saturday, June 15, 2013 8:29 PM
    Sunday, December 16, 2012 7:41 AM