Example #1
0
        public override IObjRef Dup(IObjRef objRef)
        {
            IPreparedObjRefFactory objRefConstructorDelegate = constructorDelegateMap.Get(objRef.RealType, objRef.IdNameIndex);

            if (objRefConstructorDelegate == null)
            {
                objRefConstructorDelegate = BuildDelegate(objRef.RealType, objRef.IdNameIndex);
            }
            return(objRefConstructorDelegate.CreateObjRef(objRef.Id, objRef.Version));
        }
Example #2
0
        public override IObjRef CreateObjRef(Type entityType, int idIndex, Object id, Object version)
        {
            IPreparedObjRefFactory objRefConstructorDelegate = constructorDelegateMap.Get(entityType, idIndex);

            if (objRefConstructorDelegate == null)
            {
                objRefConstructorDelegate = BuildDelegate(entityType, idIndex);
            }
            return(objRefConstructorDelegate.CreateObjRef(id, version));
        }
Example #3
0
        public override IPreparedObjRefFactory PrepareObjRefFactory(Type entityType, int idIndex)
        {
            IPreparedObjRefFactory objRefConstructorDelegate = constructorDelegateMap.Get(entityType, idIndex);

            if (objRefConstructorDelegate == null)
            {
                objRefConstructorDelegate = BuildDelegate(entityType, idIndex);
            }
            return(objRefConstructorDelegate);
        }
Example #4
0
        public override IObjRef CreateObjRef(AbstractCacheValue cacheValue, int idIndex)
        {
            IPreparedObjRefFactory objRefConstructorDelegate = constructorDelegateMap.Get(cacheValue.EntityType, idIndex);

            if (objRefConstructorDelegate == null)
            {
                objRefConstructorDelegate = BuildDelegate(cacheValue.EntityType, idIndex);
            }
            return(objRefConstructorDelegate.CreateObjRef(cacheValue.Id, cacheValue.Version));
        }
Example #5
0
        protected IPreparedObjRefFactory BuildDelegate(Type realType, int idIndex)
        {
            lock (writeLock)
            {
                IPreparedObjRefFactory objRefConstructorDelegate = constructorDelegateMap.Get(realType, idIndex);
                if (objRefConstructorDelegate != null)
                {
                    return(objRefConstructorDelegate);
                }

                Type enhancedType = BytecodeEnhancer.GetEnhancedType(typeof(Object), new ObjRefEnhancementHint(realType, idIndex));
                objRefConstructorDelegate = AccessorTypeProvider.GetConstructorType <IPreparedObjRefFactory>(enhancedType);
                constructorDelegateMap.Put(realType, idIndex, objRefConstructorDelegate);
                return(objRefConstructorDelegate);
            }
        }