Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.44k stars 68 forks source link

Duplicate foreign key name #76

Closed Giorgi closed 1 month ago

Giorgi commented 1 month ago

@Giorgi https://github.com/Eric-Ans/TestEntityFrameworkExceptions

This sample throw the error I describe previously when context.SaveChanges(); is called in main.

If you look at file : 20240731133414_InitialCreate.Designer.cs: you will see two entries with the same foreign key name : HasConstraintName("fk_montants_pieces_piece_id");

and in ExceptionProcessorInterceptor class line 118, mappedConstraints contains the same two constraint name, so ToDictionary fail.

image

image

Originally posted by @Eric-Ans in https://github.com/Giorgi/EntityFramework.Exceptions/issues/71#issuecomment-2260585140

Giorgi commented 1 month ago

Fixed in 4ea2f55d94e78bfc589c8aafc3440d36b05a3059

Eric-Ans commented 1 month ago

@Giorgi Thank you very much :) could you publish a nuget package ?

Giorgi commented 1 month ago

I'll, once I merge the open PR

Giorgi commented 1 month ago

Pushed.