comparison Examples/Nemerle/Main.n @ 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.Console;
2 using BLToolkit.Data;
3 using BLToolkit.Mapping;
4 using BLToolkit.Reflection;
5
6 namespace Test
7 {
8 public enum Gender
9 {
10 [MapValue("F")] | Female
11 [MapValue("M")] | Male
12 [MapValue("U")] | Unknown
13 [MapValue("O")] | Other
14 }
15
16 [MapField("PersonID", "ID")]
17 public class Person
18 {
19 public mutable PersonID : int;
20 public mutable FirstName : string;
21 public mutable LastName : string;
22 public mutable MiddleName : string;
23 public mutable Gender : Gender;
24 }
25
26 module Program
27 {
28 Main() : void
29 {
30 def p = Person();
31 p.FirstName = "John";
32 p.LastName = "Pupkin";
33
34 using (db = DbManager())
35 {
36 def p = db
37 .SetSpCommand("Person_SelectByName", db.CreateParameters(p))
38 .ExecuteObject() : Person;
39
40 TypeAccessor.WriteConsole(p);
41 }
42
43 WriteLine("Press enter to continue...");
44 _ = ReadLine();
45 }
46 }
47 }