0
|
1 using System;
|
|
2 using System.Collections.Generic;
|
|
3 using System.Linq.Expressions;
|
|
4
|
|
5 namespace BLToolkit.Mapping.Fluent
|
|
6 {
|
|
7 public partial class MapFieldMap<T, TR>
|
|
8 {
|
|
9 public class AssociationMap<TRt>
|
|
10 {
|
|
11 private readonly MapFieldMap<T, TR> _owner;
|
|
12 private readonly bool _canBeNull;
|
|
13 private readonly List<Expression<Func<T, TRt>>> _thisKeys;
|
|
14
|
|
15 public AssociationMap(MapFieldMap<T, TR> owner, bool canBeNull, List<Expression<Func<T, TRt>>> thisKeys)
|
|
16 {
|
|
17 this._owner = owner;
|
|
18 this._canBeNull = canBeNull;
|
|
19 this._thisKeys = thisKeys;
|
|
20 }
|
|
21
|
|
22 public MapFieldMap<T, TR> ToMany<TRf, TRo>(Expression<Func<TRf, TRo>> otherKey, params Expression<Func<TRf, TRo>>[] otherKeys)
|
|
23 {
|
|
24 var keys = new List<Expression<Func<TRf, TRo>>>(otherKeys);
|
|
25 keys.Insert(0, otherKey);
|
|
26 return this._owner.Association(this._canBeNull, this._thisKeys, keys);
|
|
27 }
|
|
28
|
|
29 public MapFieldMap<T, TR> ToOne<TRo>(Expression<Func<TR, TRo>> otherKey, params Expression<Func<TR, TRo>>[] otherKeys)
|
|
30 {
|
|
31 var keys = new List<Expression<Func<TR, TRo>>>(otherKeys);
|
|
32 keys.Insert(0, otherKey);
|
|
33 return this._owner.Association(this._canBeNull, this._thisKeys, keys);
|
|
34 }
|
|
35 }
|
|
36 }
|
|
37 } |