Mercurial > pub > bltoolkit
comparison HowTo/DataAccess/MultiplePrimaryKey.cs @ 0:f990fcb411a9
Копия текущей версии из github
| author | cin |
|---|---|
| date | Thu, 27 Mar 2014 21:46:09 +0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:f990fcb411a9 |
|---|---|
| 1 using System; | |
| 2 | |
| 3 using NUnit.Framework; | |
| 4 | |
| 5 using BLToolkit.DataAccess; | |
| 6 using BLToolkit.Mapping; | |
| 7 | |
| 8 namespace HowTo.DataAccess | |
| 9 { | |
| 10 [TestFixture] | |
| 11 public class MultiplePrimaryKey | |
| 12 { | |
| 13 [TableName("Person")] | |
| 14 public class Person | |
| 15 { | |
| 16 [MapField("PersonID"), NonUpdatable] | |
| 17 public int ID; | |
| 18 | |
| 19 // These fields are not real primary key of the table. | |
| 20 // They are made primary key for demonstration purpose only. | |
| 21 // | |
| 22 [/*[a]*/PrimaryKey(1)/*[/a]*/] public string FirstName; | |
| 23 [/*[a]*/PrimaryKey(2)/*[/a]*/] public string LastName; | |
| 24 | |
| 25 public string MiddleName; | |
| 26 } | |
| 27 | |
| 28 [Test] | |
| 29 public void Test() | |
| 30 { | |
| 31 SqlQuery<Person> query = new SqlQuery<Person>(); | |
| 32 | |
| 33 Person person = query./*[a]*/SelectByKey("Tester", "Testerson")/*[/a]*/; | |
| 34 | |
| 35 Assert.IsNotNull(person); | |
| 36 } | |
| 37 } | |
| 38 } | |
| 39 |
