public override INHibernateProxy GetProxy(object id, ISessionImplementor session) { try { log.Info("Get Intercepted Proxy object. id={0}", id); LazyInitializer initializer = new DataBindingInterceptor(EntityName, PersistentClass, id, GetIdentifierMethod, SetIdentifierMethod, ComponentIdType, session); object generatedProxy; var list = new List <Type>(Interfaces); list.Add(typeof(INotifyPropertyChanged)); var interfaces = list.ToArray(); //var list = new ArrayList(Interfaces); //list.Add(typeof(INotifyPropertyChanged)); //var interfaces = (System.Type[])list.ToArray(typeof(System.Type)); if (IsClassProxy) { generatedProxy = DefaultProxyGenerator.CreateClassProxy(PersistentClass, interfaces, ProxyGenerationOptions.Default, initializer); } else { generatedProxy = DefaultProxyGenerator.CreateInterfaceProxyWithoutTarget(interfaces[0], interfaces, initializer); } initializer._constructed = true; return((INHibernateProxy)generatedProxy); } catch (Exception ex) { log.ErrorException("Creating a proxy instance is failed. id=" + id, ex); throw new HibernateException("Creating a proxy instance is failed. id=" + id, ex); } }
public override INHibernateProxy GetProxy(object id, ISessionImplementor session) { try { log.Info("Get Intercepted Proxy object. id={0}", id); LazyInitializer initializer = new DataBindingInterceptor(EntityName, PersistentClass, id, GetIdentifierMethod, SetIdentifierMethod, ComponentIdType, session); object generatedProxy; var list = new List<Type>(Interfaces); list.Add(typeof(INotifyPropertyChanged)); var interfaces = list.ToArray(); //var list = new ArrayList(Interfaces); //list.Add(typeof(INotifyPropertyChanged)); //var interfaces = (System.Type[])list.ToArray(typeof(System.Type)); if(IsClassProxy) generatedProxy = DefaultProxyGenerator.CreateClassProxy(PersistentClass, interfaces, ProxyGenerationOptions.Default, initializer); else generatedProxy = DefaultProxyGenerator.CreateInterfaceProxyWithoutTarget(interfaces[0], interfaces, initializer); initializer._constructed = true; return (INHibernateProxy)generatedProxy; } catch(Exception ex) { log.ErrorException("Creating a proxy instance is failed. id=" + id, ex); throw new HibernateException("Creating a proxy instance is failed. id=" + id, ex); } }