Having a lot of problems adding 3 tables to a EDMX file

Rod At Work 866 Reputation points
2020-11-20T16:48:31.543+00:00

We use EDMX files whenever using Entity Framework. I had to add three new tables to a .EDMX file a colleague of mine created months ago. However, whenever I did, I got lots of error messages, it refused to add them and instead deleted most of the rest of the tables. I tried deleting the whole .EDMX file and recreating it, but that failed, claiming that an object already existed by the same name.

So now I've tried deleting all tables and views from the .EDMX designer, so I could add them back in, hoping that would work. However, I've got an error that I've never seen before and performing a Bing search doesn't reveal anything. Here's a screen capture of the error:

41397-screenshot-cannot-be-saved-2020-11-20-093807.png

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,346 questions
{count} votes

4 answers

Sort by: Most helpful
  1. Daniel Zhang-MSFT 9,611 Reputation points
    2020-11-23T03:22:04.827+00:00

    Hi Rod At Work,
    Do your three tables have primary keys?
    If not, please set Primary Keys to all tables or check "Allow null" check-box in any column of each table.
    You can also try the Craig Stuntz's method that going into the XML and look for references to the tables in question.
    Here is a related document you can refer to.
    Changes Made to an .edmx File by the Update Model Wizard
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Daniel Zhang

    1 person found this answer helpful.

  2. Daniel Zhang-MSFT 9,611 Reputation points
    2020-11-25T07:21:34.807+00:00

    Hi @Rod At Work ,
    Unknown software exception (0xe0434352) is an error that is related to .NET installation. The majority of the reasons for this error is having a faulty .NET Framework, another reason is because of some corrupted files or old drivers that are contradicting with Windows.
    You can try to perform a clean boot in Windows.
    If not successful, please try other methods in these threads.
    The exception unknown software exception (0xe0434352) occurred in the application at location 0x7702c41f
    exception unknown software exception (0xe0434352)
    Best Regards,
    Daniel Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  3. Karen Payne MVP 35,031 Reputation points
    2020-11-30T12:26:31.137+00:00

    Hello @Rod At Work ,

    As you certainly learned, EDMX usage can be problematic while using EF code first from database will not cause the current issues. A good way to convince others is to work with EF Core Power Tools (if open to using EF Core). You can reverse engineer databases by right clicking on a project and select EF Power Tools, reverse engineer. If something changes in the database e.g. add a new column you can rerun EF Power tools and it will allow you to update the model(s). On a side note, if you are modifying models e.g. adding read-only properties etc you can always use partial classes placed in a different folder than your models and keep the same namespace.

    In regards to Entity Framework vs Entity Framework Core, there are more/better way to do things in EF Core although for the most part existing code should port fine.

    Example for selecting tables
    43714-ef1.png

    Some of the configuration options
    43550-ef2.png

    1 person found this answer helpful.
    0 comments No comments

  4. Rod At Work 866 Reputation points
    2020-11-25T22:12:50.537+00:00

    Hi @Daniel Zhang-MSFT ,

    I've given up on using those .EDMX files. I think they became seriously messed up. I deleted them, then recreated the models using EF's Code First from Existing Database. No errors at all.

    Now all I have to do is convince my co-workers that this is a better approach.

    0 comments No comments