-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem using BulkMerge() method adding at runtime a new column into destination table #24
Comments
Hello @AndreaA86 ,
I would say that's the The first time our library access a table, it caches the information retrieved from the Database to don't execute query related to it over and over. However, in your case, the schema changes which cause this problem. One way to fix it, is to create a new cache. Creating a new cacheint schemaVersion = 0;
// every time the schema is modifed
schemaVersion++;
BulkOperationManager.Cache = new MemoryCache("schema_version_" + schemaVersion);
bulk.BulkMerge(dt); Let me know if that solution work for you or you would like a better one. Best Regards, Jonathan |
I tried to change BulkOperationManager.Cache as above or using a guid but the error remains.
Each time I instance the class containing the code above. I still tried to dispose the object after the using block.
|
Hello @AndreaA86 , I'm very sorry to have misleading you. You are right, that will not work. We already have a built-in method to clear the cache InformationSchemaManager.ClearInformationSchemaTable(); We obviously testing it correctly this time and it should work as expected. Best Regards, Jonathan |
Thanks. It works. |
Hi,
I have a problem using the BulkMerge() method when I add a new column into the destination table while the application is running. In this case occurs the following error:
Here I report the related code:
I'm using the table BM_Items where to export data retrieved from a DataTable (The first time the IdERPUoM column is not added into the table).
After that the first export has been executed (the app is still running) I add the new column "IdERPUoM" and I reinvoke the BulkMerge. In this case occurs the above error:
If I rerun the application the error doesn't occurs and the export works correctly.
Potential bug:
From what I understand the error depends on the fact that if I do at least an export with BulkMerge in the destination table, if I then make changes on this table, while the application is still running, the Bulk library does not detect the new column. If then restart the app the problem is solved.
I need an urgent answer. I would like to know if it's a bug or if I'm missing something in the configuration of the BulkOperation object.
Thanks in advance.
The text was updated successfully, but these errors were encountered: