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

Private classes derived from models cause errors


I found two seperate errors.

If you write a private subclass of a model that is mapped to a table, and this private subclass adds properties, EF will update the tables to also include these properties. BulkInsert does not seem to detect these private classes and will miss these values when inserting, causing an InvalidOperationException (Value cannot be null). At this point BulkInsert doesn't work entirely, every call will throw an exception.

In the case you don't want EF to add these properties to the database developers can use the attribute [NotMapped] to flag the subclass to be ignored by EF. However when you use this and call BulkInsert and pass a collection that contains an instance of a [NotMapped] subclass, an exception will be thrown too.