Updating your edmx to reflect changes made in your db (.net linq-to-entities)

前端 未结 11 2145
遥遥无期
遥遥无期 2020-12-04 11:59
  • So I have my edmx made.
  • Then I change my database a little bit, changing a column to from being a NOT NULL to allowing NULL.
  • I go into my edmx, rig
11条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 13:03

    A view I created in the database was not appearing in the designer (after choosing "Update model from database..." and adding a check next to the name of the view). I saw no error message until I switched the EDMX to xml view:

    • Right click the edmx file
    • Select "Open With..."
    • Select "Automatic Editor Selector (XML)"
    • Click Find and search for your view name

    In the edmx xml I found:

    "Errors Found During Generation: warning 6013: The table/view '(view name)' does not have a primary key defined and no valid primary key could be inferred. This table/view has been excluded. To use the entity, you will need to review your schema, add the correct keys, and uncomment it."

    I modified the view to have a primary key. Then I opened the edmx designer and ran "Update model from database..." and the view then appeared in the designer as expected with no errors.

提交回复
热议问题