This repository was archived by the owner on Dec 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-2
lines changed
tests/ServiceStack.OrmLite.Tests Expand file tree Collapse file tree 2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -910,8 +910,8 @@ Global
910910 {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Release| x86 .ActiveCfg = Release| Any CPU
911911 {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Any CPU .ActiveCfg = Release| Any CPU
912912 {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Any CPU .Build .0 = Release| Any CPU
913- {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Mixed Platforms .ActiveCfg = Release |Any CPU
914- {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Mixed Platforms .Build .0 = Release |Any CPU
913+ {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Mixed Platforms .ActiveCfg = Signed |Any CPU
914+ {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| Mixed Platforms .Build .0 = Signed |Any CPU
915915 {9A5CCB1A-D127-41D1-9F25-91848E60672B} .Signed| x86 .ActiveCfg = Release| Any CPU
916916 {1BCE2206-A9F9-4381-B4F7-F617998447A1} .Debug| Any CPU .ActiveCfg = Debug| Any CPU
917917 {1BCE2206-A9F9-4381-B4F7-F617998447A1} .Debug| Any CPU .Build .0 = Debug| Any CPU
Original file line number Diff line number Diff line change 11using System ;
22using System . Collections . Generic ;
33using System . Data ;
4+ using System . Linq ;
45using NUnit . Framework ;
56using ServiceStack . Common . Tests . Models ;
7+ using ServiceStack . OrmLite . Tests . Shared ;
68using ServiceStack . Text ;
79
810namespace ServiceStack . OrmLite . Tests
@@ -136,5 +138,26 @@ public void Can_Update_Many_Into_Table_With_Id_Only()
136138 var list = new List < ModelWithIdOnly > { row1 , row2 } ;
137139 db . UpdateAll ( list ) ;
138140 }
141+
142+ [ Test ]
143+ public void Can_UpdateOnly_multiple_columns ( )
144+ {
145+ db . DropAndCreateTable < Person > ( ) ;
146+
147+ db . Insert ( new Person { FirstName = "FirstName" , Age = 100 } ) ;
148+
149+ var existingPerson = db . Select < Person > ( ) . First ( ) ;
150+
151+ existingPerson . FirstName = "JJ" ;
152+ existingPerson . Age = 12 ;
153+
154+ db . UpdateOnly ( existingPerson ,
155+ onlyFields : p => new { p . FirstName , p . Age } ) ;
156+
157+ var person = db . Select < Person > ( ) . First ( ) ;
158+
159+ Assert . That ( person . FirstName , Is . EqualTo ( "JJ" ) ) ;
160+ Assert . That ( person . Age , Is . EqualTo ( 12 ) ) ;
161+ }
139162 }
140163}
You can’t perform that action at this time.
0 commit comments