This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Hi , we just try to perform bulk insert(10 records at a time).But its working like a lazy loading. the code is as follows. foreach (TbPerson person in personList) Is there any other approach for Eager Bulk insert.
Thanks and regard, upendran P.V.
|
|
|
Are you looking to flush objects to the database one at a time as you add them to the UnitOfWork? If so, you should call SaveChanges() within the foreach loop. If you want to flush after every 10 add's, just add a counter into your loop which would call SaveChanges() accordingly and set the BatchSize to 10. The default behavior for LightSpeed is to flush all changes in batched sets (depending on the provider) when you call SaveChanges(). By having it outside of the loop, you are indicating you want to load up all of the new objects into the UnitOfWork and then flush them as a single set. There has been some previous discussion about Bulk Inserts in the thread here: http://www.mindscape.co.nz/forums/Thread.aspx?ThreadID=2573 Ivan posted some recommendations at the bottom of the thread which should hopefully help you with this.
Jeremy |
|