This project has moved. For the latest updates, please go here.
1

Closed

Foreign keys mapping issue

description

I am attempting to use your BulkInsert library and encountering an exception in MappingAPI. I am using the latest versions of Entity Framework and your NuGet Packages.
<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.1.0" targetFramework="net45" />
  <package id="EntityFramework.BulkInsert-ef6" version="6.0.2.8" targetFramework="net45" />
  <package id="EntityFramework.MappingAPI" version="6.0.0.7" targetFramework="net45" />
</packages>
The exception occurs the first time I call context.BulkInsert() and occurs in MappingAPI.Mappers.MapperBase.BindForeignKeys(). I have attached the stack trace. The exception message is "The given key was not present in the dictionary.". On debugging where the exception occurs, I find that the line is
fkCol.FkTargetColumn = pkDict[fkCol.FkTargetEdmMember];
When the exception is thrown fkCol.FkTargetEdmMember is for "LdrFileTypeId", which is an Enum typed foreign key. I don't know if this has anything to do with the exception being thrown, but I was wondering if there are any known issues with this setup. I will continue to debug this issue and let you know if I am able to make any more progress.
Thank you for your effort in creating this library and I look forward to using it.

file attachments

Closed Jan 20, 2015 at 8:45 PM by maxlego

comments

maxlego wrote Nov 1, 2014 at 9:08 PM

Were you using DB-first or Code-first approach?
Maybe new version of mapping API has solved the issue. Give it a try

assurexmichael wrote Nov 7, 2014 at 3:20 PM

We are using the DB-first approach. I tried the new version of Mapping API, but unfortunately I encountered the same issue. The exception appears to be the same as before. When I have some time to dig a little deeper I'll try to provide some more details. Thanks!

maxlego wrote Nov 13, 2014 at 7:14 PM

ok.. I fixed PK mapping issue.
give another try

wrote Nov 13, 2014 at 7:15 PM

assurexmichael wrote Nov 13, 2014 at 9:17 PM

The issue appears to be fixed. Thank you!

wrote Nov 15, 2014 at 7:32 PM

wrote Jan 20, 2015 at 8:45 PM