0
|
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 NonUpdatable
|
|
12 {
|
|
13 public enum Gender
|
|
14 {
|
|
15 [MapValue("F")] Female,
|
|
16 [MapValue("M")] Male,
|
|
17 [MapValue("U")] Unknown,
|
|
18 [MapValue("O")] Other
|
|
19 }
|
|
20
|
|
21 public class Person
|
|
22 {
|
|
23 [MapField("PersonID"), PrimaryKey, /*[a]*/NonUpdatable/*[/a]*/]
|
|
24 public int ID;
|
|
25
|
|
26 public string LastName;
|
|
27 public string FirstName;
|
|
28 public string MiddleName;
|
|
29 public Gender Gender;
|
|
30 }
|
|
31
|
|
32 [Test]
|
|
33 public void Test()
|
|
34 {
|
|
35 SqlQuery<Person> query = new SqlQuery<Person>();
|
|
36
|
|
37 Person person = new Person();
|
|
38
|
|
39 person.FirstName = "Crazy";
|
|
40 person.LastName = "Frog";
|
|
41 person.Gender = Gender.Other;
|
|
42
|
|
43 query./*[a]*/Insert(person)/*[/a]*/;
|
|
44 }
|
|
45 }
|
|
46 }
|