Navigation
Catalog: Farseer.net Lightweight Open source Framework Catalog
Previous: Farseer.net lightweight Open Source Framework introductory article: Add data in detail
Next: Farseer.net Lightweight open source framework Getting started: deleting data in detail
Several ways to update (basic)
new Users (); 2 info. UserName = Zhang San " 3 info. PassWord = password " 4 //
6 Users.Data.Where (o = = O.id = 1). Update (info);
1 // new Users () {User Name = Zhang San , PassWord = " Password }; 3 Users.Data.Update (1 , info);
1 // new Users () {User Name = Zhang San , PassWord = " Password }; 3 info.id = ; 4 Users.Data.Update (info);
1 // new Users () {User Name = Zhang San , PassWord = " Password }; 3 info. Update (1 );
1 // 2 new Users () {UserName = " Zhang San " , PassWord = " password " }. Update (1 );
1 // new Users () {User Name = Zhang San , PassWord = " Password }; 3 info.id = ; 4 info. Update ();
1 // Bulk Modification User IDs are: 1, 2, 3, 4, 5 2 var New list<int12345 }; 3 Users.Data.Where (o = lst. Contains (o.id)). Update (info);
Several ways to update (single value)
1 // field value specified plus 1 2 1 1 ); 3 1 New {O.logincount}). Updatevalue (1); 4 New {O.logincount}). Updatevalue (11);
Of these, add 1 is available through the parameter changes. The last parameter 1 of the three methods above is to pass in the value to be superimposed.
The 1 in front of the 4th line of code represents id==1.
Framework conventions
When the property is not assigned a value, that is, when the property is null. is not generated for the corresponding field SQL.
Such as:
1 New " Zhang San " }. Update (1);
The users entity actually has many fields, such as password, Gendertype, Logincount, and so on.
Because we do not assign a value to it, it is null, so. The database is not assigned a value. That is, the equivalent SQL is:
1 Update Set Where ID = 1
Navigation
Catalog: Farseer.net Lightweight Open source Framework Catalog
Previous: Farseer.net lightweight Open Source Framework introductory article: Add data in detail
Next: Farseer.net Lightweight open source framework Getting started: deleting data in detail
Farseer.net Lightweight Open Source Framework introductory article: Modifying Data in detail