Is it possible to add a where clause to update through objectcontext?
Posted: Wed 29 Mar 2017 00:57
Is it possible to add a where clause to objects updated through objectcontext?
var _Customer = this.objectcontext.Customers.where(x=>x.CustomerID == 1).First();
_Customer.FirstName = "Dan";
_Customer.AddWhereOnUpdateCondition('FirstName' != 'Dan' );
_objectcontext.SaveChanges();
Here is what I'm looking for:
https://weblogs.asp.net/pwelter34/entit ... re-queries
Would these extension methods work with your provider for MySQL?
Sql executed would look like:
Update Customer set FirstName = 'Dan' where FirstName != 'Dan' //0 rows affected
var _Customer = this.objectcontext.Customers.where(x=>x.CustomerID == 1).First();
_Customer.FirstName = "Dan";
_Customer.AddWhereOnUpdateCondition('FirstName' != 'Dan' );
_objectcontext.SaveChanges();
Here is what I'm looking for:
https://weblogs.asp.net/pwelter34/entit ... re-queries
Would these extension methods work with your provider for MySQL?
Sql executed would look like:
Update Customer set FirstName = 'Dan' where FirstName != 'Dan' //0 rows affected