Mercurial > pub > bltoolkit
comparison HowTo/DataAccess/ActionName.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 NUnit.Framework; | |
3 using BLToolkit.DataAccess; | |
4 | |
5 namespace HowTo.DataAccess | |
6 { | |
7 [TestFixture] | |
8 public class ActionName | |
9 { | |
10 public abstract class PersonAccessor : DataAccessor<Person, PersonAccessor> | |
11 { | |
12 // Default action name is 'SelectByKey'. | |
13 // Stored procedure name is 'Person_SelectByKey'. | |
14 // | |
15 public abstract Person SelectByKey(int @id); | |
16 | |
17 // Explicit action name is 'SelectByName'. | |
18 // Stored procedure name is 'Person_SelectByName'. | |
19 // | |
20 [/*[a]*/ActionName/*[/a]*/(/*[a]*/"SelectByName"/*[/a]*/)] | |
21 public abstract Person /*[a]*/AnyName/*[/a]*/ (string @firstName, string @lastName); | |
22 } | |
23 | |
24 [Test] | |
25 public void Test() | |
26 { | |
27 PersonAccessor pa = /*[a]*/PersonAccessor.CreateInstance/*[/a]*/(); | |
28 | |
29 Person person1 = pa.SelectByKey(1); | |
30 | |
31 Assert.IsNotNull(person1); | |
32 | |
33 Person person2 = pa.AnyName(person1.FirstName, person1.LastName); | |
34 | |
35 Assert.AreEqual(person1.ID, person2.ID); | |
36 } | |
37 } | |
38 } |