gspk wrote:
Hi Phil,
Thanks a lot for your post. couuld you please provide me with the sample code how you used it and also the statistics which you were mentioning. That would be of great help.
gspk
I don't know where I got the link from, but I based my code on this article. I use roughly the same code, but I hardcoded all my column creation for the datatable and the mapping between Entity fields and datatable columns:
http://davidhayden.com/blog/dave/archive/2006/03/08/2877.aspx
There are some gotchas to doing it this way--I had to hardcode much of the EntityCollection => DataTable code. I started by trying to do it the way that is described in this post:
http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=3861&HighLight=1
But it seems that datatables can't use nullable types. There might be a way around this that I don't know about.
It also seems that the columns used in the SqlBulkCopy need to be in the exact order that they are in the database, or it won't work. You also can't skip columns. Again, there might be ways of working around this, but I just wanted to get it working for a Proof of Concept project that I am working on.
I will see if I can generate some metrics. Keep in mind that any numbers will all be relative--I don't have a great testing environment.
HTH,
Phil