We need to SQLBulkCopy
a collection that we have. And since we need an IDataReader to use SQLBulkCopy, I tried to use FastMember for that. As I understand, we can use FastMember
to create an IDataReader
from an IEnumerable.
So my code reads-
using (var reader = ObjectReader.Create(customer.Records)
{
DataAccess.BulkInsert(serverName, databaseName, tableName, reader);
}
But the issue is that each record has a child object called which has further properties in it that i want to have in data reader so that they can be inserted into the table in database. But cant find a way to get a flatten IDataReader