NorthernLight1 / N.EntityFramework.Extensions

Bulk data support for the EntityFramework 6.5.0+
MIT License
35 stars 20 forks source link

BulkInsert - Invalid column name '$Action' #143

Closed vnizampatnam closed 3 weeks ago

vnizampatnam commented 4 months ago

I'm trying to call a BulkInsert but I'm facing this: Invalid column name '$Action'.

List lst = new List(); for (int i = 0; i < 1000; i++) { lst.Add(new ENTITY_TRIP { TRANSACTIONID = 100001 + i, EVENTID = 1, UPDATEDATE = DateTime.Now, USERID = "test" }); } objContext.Database.Log = Console.WriteLine; objContext.BulkInsert(lst, options => { options.CommandTimeout = 30; options.BatchSize = 100000; options.InsertIfNotExists = true; options.InsertOnCondition = (s, t) => s.TRANSACTIONID == t.TRANSACTIONID; options.KeepIdentity = true; options.AutoMapOutput = false; });

NorthernLight1 commented 3 months ago

vnizampatnam,

I am unable to reproduce this issue. Can you please provide the call stack and any additional details you think is relevant.

yuejunwu commented 2 months ago

I believe it's due to the database collation settings. I encountered the same issue when using BulkMerge. The collation of my database is Chinese_Taiwan_Stroke_CS_AS, which is case-sensitive. After changing $Action to $action on line 345 of DbContextExtensions.cs, it worked correctly.

NorthernLight1 commented 2 months ago

The issue should be resolved in v1.9.1. Can you validate it?

yuejunwu commented 2 months ago

I tried v1.9.1, and it worked correctly.