0
|
1 #region
|
|
2
|
|
3 using System;
|
|
4 using BLToolkit.Data;
|
|
5 using BLToolkit.Reflection;
|
|
6
|
|
7 #endregion
|
|
8
|
|
9 namespace BLToolkit.Mapping
|
|
10 {
|
|
11 public class DataBindingObjectMapper : ObjectMapper
|
|
12 {
|
|
13 private readonly Type _type;
|
|
14
|
|
15 public DataBindingObjectMapper(Type type)
|
|
16 {
|
|
17 _type = type;
|
|
18 }
|
|
19
|
|
20 public override object CreateInstance()
|
|
21 {
|
|
22 return TypeFactory.DataBindingFactory.Create(_type);
|
|
23 }
|
|
24
|
|
25 public override object CreateInstance(InitContext context)
|
|
26 {
|
|
27 return CreateInstance();
|
|
28 }
|
|
29 }
|
|
30
|
|
31 public class FullDataBindingObjectMapper : FullObjectMapper
|
|
32 {
|
|
33 public FullDataBindingObjectMapper(DbManager db, bool ignoreLazyLoading) : base(db, ignoreLazyLoading, FactoryType.LazyLoadingWithDataBinding)
|
|
34 {
|
|
35 }
|
|
36
|
|
37 public override object CreateInstance()
|
|
38 {
|
|
39 object result = ContainsLazyChild
|
|
40 ? TypeFactory.LazyLoadingWithDataBinding.Create(PropertyType, this, LoadLazy)
|
|
41 : base.CreateInstance();
|
|
42
|
|
43 return result;
|
|
44 }
|
|
45 }
|
|
46 } |