I'm using LLBLGen 3.1, Self Servicing to migrate data to a new system. There are millions of rows & at the current rate it will take weeks to move the data. We move entities in batches of ~200 and I've noticed that the batches start out very fast and get dramatically slower. I'm guessing I need to turn off indexes temporarily.
So I turned off an index for a table 'Message':
alter index PK__Message__36B12243 on [MESSAGE] disable
but when I save I get this error:
An exception was caught during the execution of an action query: The query processor is unable to produce a plan because the index 'PK__Message__36B12243' on table or view 'Message' is disabled.. Check InnerException, QueryExecuted and Parameters of this exception to examine the cause of this exception.
Then I figured that LLBLGen is refetching after the save, so I tried three different things:
EntityBase.MarkSavedEntitiesAsFetched = true;
<add key="markSavedEntitiesAsFetched" value="true"/>
newMessage.Fields.State = EntityState.Fetched;
None of it prevented the exception. Am I thinking of this wrong? My code basically looks like this:
var newMessages = new New_MessageCollection();
for(var oldMessage in oldMessages)
{
var newMessage = new New_MessageEntity();
newMessage.Id = GuidComb.NewGuid();
newMessage.LegacyId = oldMessage.MessageId;
newMessage.Subject = oldMessage.Subject;
newMessage.Body = oldMessage.ParseBody();
newMessages.Add(newMessage);
}
newMessages.Save(false);