This project has moved and is read-only. For the latest updates, please go here.
1
Vote

MappedDataReader - KeyNotFoundException

description

Hi!
When using EFBulkInsert with table per hierarchy, I get a lot of "KeyNotFoundException"s in the MappedDataReader which considerably slows down the bulk insert operation.
Also, those "not found"s are intended so they should basically be ignored - which is done by this framework by swallowing the "KeyNotFoundException"s.

So please change the MappedDataReaders "GetValue(int i) method to look like this:
 public object GetValue(int i)
        {
            if (_enumerator.Current == null)
            {
                return null;
            }

            try
            {
                object value;
                Func<T, object> func;
                if (_currentEntityTypeSelectors.TryGetValue(i, out func))
                {

                    value = func(_enumerator.Current);
// .....

comments