InvalidOperationException if a context has foreign keys upon multiple columns
Hi!
I tried to connect this library to the project I work on but found the issue which makes it impossible for us to use it because it throws InvalidOperationException on initialization. The investigation shows that the reason is that some of the foreign keys we have been set upon multiple columns, while LazyEntityGraph expect there is alwas a single one:
IPropertyBase fkPrincipalProp = fkProp.PrincipalKey.Properties.Single();
var foreignKeyPropInfo = fkProp.Properties.Single().PropertyInfo;
Here I came up with the test reproducing the issue and I was hoping I'll be able to fix it myself and submit a pull request but it seems, this can be more tricky that I can handle.
@dbroudy do you maybe have an idea about how this can be fixed?
@Pankraty Thanks for the report and the test case. It requires some changes to the ForeignKeyConstraint too, not just the key selectors, but I think it's not going to be too bad. I have some changes in progress and just have to do some more testing.