comparison Source/Mapping/MapRelationBase.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
3 namespace BLToolkit.Mapping
4 {
5 public class MapRelationBase
6 {
7 public MapRelationBase(
8 Type slave,
9 MapIndex slaveIndex,
10 MapIndex masterIndex,
11 string containerName)
12 {
13 if (slave == null)
14 throw new ArgumentNullException("slave");
15
16 if (masterIndex.Fields.Length == 0)
17 throw new MappingException("Master index length can not be 0.");
18
19 if ( slaveIndex.Fields.Length == 0)
20 throw new MappingException("Slave index length can not be 0.");
21
22 if (masterIndex.Fields.Length != slaveIndex.Fields.Length)
23 throw new MappingException("Master and slave indexes do not match.");
24
25 if (string.IsNullOrEmpty(containerName))
26 throw new MappingException("Master container field name is wrong.");
27
28 _slave = slave;
29 _masterIndex = masterIndex;
30 _slaveIndex = slaveIndex;
31 _containerName = containerName;
32 }
33
34 private readonly MapIndex _masterIndex;
35 public MapIndex MasterIndex
36 {
37 get { return _masterIndex; }
38 }
39
40 private readonly MapIndex _slaveIndex;
41 public MapIndex SlaveIndex
42 {
43 get { return _slaveIndex; }
44 }
45
46 private readonly string _containerName;
47 public string ContainerName
48 {
49 get { return _containerName; }
50 }
51
52 private readonly Type _slave;
53 public Type Slave
54 {
55 get { return _slave; }
56 }
57 }
58 }