c# - Is there a way to make DbSet.AddOrUpdate case sensitive? -


i have data set (show below) each record unique on 2 fields when considering case senstivity -

var dataset1 = new dataset() { country = "uk", city = "london", ... } var dataset1 = new dataset() { country = "uk", city = "london", ... } 

on executing dbset.addorupdate() below -

database.datasets.addorupdate(ds => new {     ds.country,     ds.city, }, datalist.toarray());  database.savechanges(); 

i getting system.invalidoperationexception: sequence contains more 1 element

the cause of exception pretty obvious return 2 records when querying city = 'london'

question - there way make dbset.addorupdate case sensitive?

ps: dataset coming external source cannot tweak persist. instance, change city upper case , ignore duplicates not allowed.

you need set database case sensitive. @ moment it's ci (case insensitive).


Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -