forked from nhibernate/nhibernate-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDynamicMapEntityTuplizer.cs
68 lines (56 loc) · 1.79 KB
/
DynamicMapEntityTuplizer.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections;
using System.Text;
using NHibernate.Mapping;
using NHibernate.Properties;
using NHibernate.Proxy;
using NHibernate.Proxy.Map;
namespace NHibernate.Tuple.Entity
{
public class DynamicMapEntityTuplizer : AbstractEntityTuplizer
{
private static readonly INHibernateLogger log = NHibernateLogger.For(typeof(PocoEntityTuplizer));
internal DynamicMapEntityTuplizer(EntityMetamodel entityMetamodel, PersistentClass mappingInfo)
: base(entityMetamodel, mappingInfo)
{
// NH different behavior fo NH-1587
Instantiator = BuildInstantiator(mappingInfo);
}
public override System.Type ConcreteProxyClass
{
get { return typeof(IDictionary); }
}
public override bool IsInstrumented
{
get { return false; }
}
public override System.Type MappedClass
{
get { return typeof(IDictionary); }
}
public override EntityMode EntityMode
{
get { return EntityMode.Map; }
}
protected override IGetter BuildPropertyGetter(Mapping.Property mappedProperty, PersistentClass mappedEntity)
{
return BuildPropertyAccessor(mappedProperty).GetGetter(null, mappedProperty.Name);
}
private IPropertyAccessor BuildPropertyAccessor(Mapping.Property property)
{
return PropertyAccessorFactory.DynamicMapPropertyAccessor;
}
protected override ISetter BuildPropertySetter(Mapping.Property mappedProperty, PersistentClass mappedEntity)
{
return BuildPropertyAccessor(mappedProperty).GetSetter(null, mappedProperty.Name);
}
protected override IInstantiator BuildInstantiator(PersistentClass mappingInfo)
{
return new DynamicEntityInstantiator(mappingInfo);
}
protected override IProxyFactory BuildProxyFactory(PersistentClass mappingInfo, IGetter idGetter, ISetter idSetter)
{
return new MapProxyFactory(EntityName);
}
}
}