Mercurial > pub > bltoolkit
comparison UnitTests/Linq/L2SAttributes.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 using System.Data.Linq.Mapping; | |
| 3 | |
| 4 using NUnit.Framework; | |
| 5 | |
| 6 using BLToolkit.Common; | |
| 7 using BLToolkit.Data.Linq; | |
| 8 | |
| 9 namespace Data.Linq | |
| 10 { | |
| 11 [Table(Name = "Person")] | |
| 12 public class L2SPersons | |
| 13 { | |
| 14 private int _personID; | |
| 15 | |
| 16 [Column( | |
| 17 Storage = "_personID", | |
| 18 Name = "PersonID", | |
| 19 DbType = "integer(32,0)", | |
| 20 IsPrimaryKey = true, | |
| 21 IsDbGenerated = true, | |
| 22 AutoSync = AutoSync.Never, | |
| 23 CanBeNull = false)] | |
| 24 public int PersonID | |
| 25 { | |
| 26 get { return _personID; } | |
| 27 set { _personID = value; } | |
| 28 } | |
| 29 [Column] public string FirstName { get; set; } | |
| 30 [Column] public string LastName; | |
| 31 [Column] public string MiddleName; | |
| 32 [Column] public string Gender; | |
| 33 } | |
| 34 | |
| 35 [TestFixture] | |
| 36 public class L2SAttributes : TestBase | |
| 37 { | |
| 38 [Test] | |
| 39 public void IsDbGeneratedTest([IncludeDataContexts("Sql2008", "Sql2012")] string context) | |
| 40 { | |
| 41 using (var db = new TestDbManager(context)) | |
| 42 { | |
| 43 db.BeginTransaction(); | |
| 44 | |
| 45 var id = db.InsertWithIdentity(new L2SPersons | |
| 46 { | |
| 47 FirstName = "Test", | |
| 48 LastName = "Test", | |
| 49 Gender = "M" | |
| 50 }); | |
| 51 | |
| 52 db.GetTable<L2SPersons>().Delete(p => p.PersonID == ConvertTo<int>.From(id)); | |
| 53 } | |
| 54 } | |
| 55 } | |
| 56 } |
