0
|
1 using System;
|
|
2 using System.Data;
|
|
3
|
|
4 using NUnit.Framework;
|
|
5
|
|
6 using BLToolkit.Data;
|
|
7 using BLToolkit.Mapping;
|
|
8
|
|
9 namespace Data
|
|
10 {
|
|
11 [TestFixture]
|
|
12 public class CompositeKeyTest
|
|
13 {
|
|
14 public class CompositeKey
|
|
15 {
|
|
16 public int Id;
|
|
17 public int Revision;
|
|
18 }
|
|
19
|
|
20 [MapField("Id", "Key.Id")]
|
|
21 [MapField("Revision", "Key.Revision")]
|
|
22 public class Entity
|
|
23 {
|
|
24 public CompositeKey Key = new CompositeKey();
|
|
25 public string Name;
|
|
26 }
|
|
27
|
|
28 [Test]
|
|
29 public void CompositeObjectTest()
|
|
30 {
|
|
31 using (DbManager db = new DbManager())
|
|
32 {
|
|
33 IDbDataParameter[] prms = db.CreateParameters(new Entity());
|
|
34 Assert.AreEqual(3, prms.Length);
|
|
35 }
|
|
36 }
|
|
37 }
|
|
38 }
|