locked
Import two tables with the same table names butdifferent table schemas in ADO.NET Entity Framework RRS feed

  • Question

  • Hi, I have two tables with the same name but different schema need to import to ADO.NET Entity for query. For example, Dev.CompanyA.Invoice and Dev.CompanyB.Invoice. When I imported these two tables into ADO.NET Entity Framework, I got Invoice and Invoice1 in the entity model designer. This is not what I expected. Is there anyway to import tables along with their schema? or is there anyway I can import tables with the same name but different schema into ADO.NET Entity Framework?

    Thanks,

    Julie

    Wednesday, August 3, 2011 7:28 PM

Answers

  • On 8/3/2011 3:43 PM, Julie C. _ wrote:
    > Well, it's hard to do that if you have a lot of tables fall in this
    > case. And I actually tried this before, but it's hard to tell which
    > Invoice entity is linked to which table in the original database since
    > you already lost the schema information in the entity model designer.
     
    You can always try to edit the edmx for the model. It's just text XML. I
    have edited the edmx to remove associations off of the entities. Maybe
    you can do the rename there. In this case,  you would have to come back
    to the model in the VS IDE and do a validate on the model.
     
    • Marked as answer by Alan_chen Tuesday, August 23, 2011 5:27 AM
    Wednesday, August 3, 2011 8:03 PM

All replies

  • On 8/3/2011 3:28 PM, Julie C. _ wrote:
    > Hi, I have two tables with the *same name but different schema* need to
    > import to ADO.NET Entity for query. For example, *Dev.CompanyA.Invoice*
    > and *Dev.CompanyB.Invoice*. When I imported these two tables into
    > ADO.NET Entity Framework, I got Invoice and Invoice1 in the entity model
    > designer. This is not what I expected. Is there anyway to import tables
    > along with their schema? or is there anyway I can import tables with the
    > same name but different schema into ADO.NET Entity Framework?
    >
     
    I believe you can go rename those entities on the model just like you
    can rename a property in the entity by right-clicking the entity.
     
     
    Wednesday, August 3, 2011 7:35 PM
  • Well, it's hard to do that if you have a lot of tables fall in this case. And I actually tried this before, but it's hard to tell which Invoice entity is linked to which table in the original database since you already lost the schema information in the entity model designer.
    Wednesday, August 3, 2011 7:43 PM
  • On 8/3/2011 3:43 PM, Julie C. _ wrote:
    > Well, it's hard to do that if you have a lot of tables fall in this
    > case. And I actually tried this before, but it's hard to tell which
    > Invoice entity is linked to which table in the original database since
    > you already lost the schema information in the entity model designer.
     
    You can always try to edit the edmx for the model. It's just text XML. I
    have edited the edmx to remove associations off of the entities. Maybe
    you can do the rename there. In this case,  you would have to come back
    to the model in the VS IDE and do a validate on the model.
     
    • Marked as answer by Alan_chen Tuesday, August 23, 2011 5:27 AM
    Wednesday, August 3, 2011 8:03 PM
  • Hi,

    I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?

    If you need further assistance, please feel free to let me know. I will be more than happy to be of assistance. 

    Have a nice day.


    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 11, 2011 8:30 AM