I have to do a batch insert of a lot of entities, so I figured the best way to do that was to use the SqlBulkCopy
class. However, that class operates on DataReader
instances, whereas my code works with an IEnumerable where T is my entity class. To convert my IEnumerable to a DataReader, I found the following code: LINQ Entity Data Reader.
This code works fine, but there is one problem: enum properties on my entity type are not included in the datareader (and therefore not being inserted correctly). How can I have the enum type properties be recognized?