private NHibernateProxyObjectReference(SerializationInfo info, StreamingContext context) { _proxyFactoryInfo = (NHibernateProxyFactoryInfo)info.GetValue(nameof(_proxyFactoryInfo), typeof(NHibernateProxyFactoryInfo)); _identifier = info.GetValue(nameof(_identifier), typeof(object)); // 6.0 TODO: simplify with info.GetValue(nameof(_implementation), typeof(object)); foreach (var entry in info) { if (entry.Name == nameof(_implementation)) { _implementation = entry.Value; } } }
private FieldInterceptorObjectReference(SerializationInfo info, StreamingContext context) { _proxyFactoryInfo = info.GetValue <NHibernateProxyFactoryInfo>(nameof(_proxyFactoryInfo)); _fieldInterceptor = info.GetValue <IFieldInterceptor>(nameof(_fieldInterceptor)); if (info.GetBoolean(HasAdditionalDataName)) { _deserializedProxy = _proxyFactoryInfo.CreateProxyFactory().GetFieldInterceptionProxy(null); var additionalMembers = info.GetValue <MemberInfo[]>(AdditionalMemberName); if (additionalMembers == null) { return; } foreach (var member in additionalMembers) { switch (member) { case FieldInfo field: field.SetValue( _deserializedProxy, info.GetValue(GetAdditionalMemberName(field), field.FieldType)); break; case PropertyInfo property: property.SetValue( _deserializedProxy, info.GetValue(GetAdditionalMemberName(property), property.PropertyType)); break; default: throw new NotSupportedException( $"Deserializing a member of type {member.GetType()} is not supported."); } } } else { // Base type has a custom serialization, we need to call the proxy deserialization for deserializing // base type members too. var proxyType = _proxyFactoryInfo.CreateProxyFactory().GetFieldInterceptionProxy(null).GetType(); var deserializationConstructor = proxyType.GetConstructor( BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, new[] { typeof(SerializationInfo), typeof(StreamingContext) }, null); _deserializedProxy = deserializationConstructor.Invoke(new object[] { info, context }); } ((IFieldInterceptorAccessor)_deserializedProxy).FieldInterceptor = _fieldInterceptor; }
public override void PostInstantiate( string entityName, System.Type persistentClass, ISet <System.Type> interfaces, MethodInfo getIdentifierMethod, MethodInfo setIdentifierMethod, IAbstractComponentType componentIdType) { base.PostInstantiate(entityName, persistentClass, interfaces, getIdentifierMethod, setIdentifierMethod, componentIdType); _proxyFactoryInfo = new NHibernateProxyFactoryInfo( EntityName, PersistentClass, Interfaces, GetIdentifierMethod, SetIdentifierMethod, ComponentIdType); _cacheEntry = new ProxyCacheEntry(IsClassProxy ? PersistentClass : typeof(object), Interfaces); }
public NHibernateProxyObjectReference(NHibernateProxyFactoryInfo proxyFactoryInfo, object identifier, object implementation) { _proxyFactoryInfo = proxyFactoryInfo; _identifier = identifier; _implementation = implementation; }
public NHibernateProxyObjectReference(NHibernateProxyFactoryInfo proxyFactoryInfo, object identifier) : this(proxyFactoryInfo, identifier, null) { }
public FieldInterceptorObjectReference(NHibernateProxyFactoryInfo proxyFactoryInfo, IFieldInterceptor fieldInterceptorField) { _proxyFactoryInfo = proxyFactoryInfo; _fieldInterceptor = fieldInterceptorField; }
private NHibernateProxyObjectReference(SerializationInfo info, StreamingContext context) { _proxyFactoryInfo = (NHibernateProxyFactoryInfo)info.GetValue(nameof(_proxyFactoryInfo), typeof(NHibernateProxyFactoryInfo)); _identifier = info.GetValue(nameof(_identifier), typeof(object)); }
public NHibernateProxyObjectReference(NHibernateProxyFactoryInfo proxyFactoryInfo, object identifier) { _proxyFactoryInfo = proxyFactoryInfo; _identifier = identifier; }