Esempio n. 1
0
        public override ObjRefStore CreateObjRefStore(Type entityType, sbyte idIndex, Object id)
        {
            IObjRefStoreFactory objRefConstructorDelegate = constructorDelegateMap.Get(entityType, idIndex);

            if (objRefConstructorDelegate == null)
            {
                objRefConstructorDelegate = BuildDelegate(entityType, idIndex);
            }
            ObjRefStore objRefStore = objRefConstructorDelegate.CreateObjRef();

            objRefStore.Id = id;
            return(objRefStore);
        }
Esempio n. 2
0
 protected IObjRefStoreFactory BuildDelegate(Type entityType, int idIndex)
 {
     lock (writeLock)
     {
         IObjRefStoreFactory objRefConstructorDelegate = constructorDelegateMap.Get(entityType, idIndex);
         if (objRefConstructorDelegate != null)
         {
             return(objRefConstructorDelegate);
         }
         Type enhancedType = BytecodeEnhancer.GetEnhancedType(typeof(ObjRefStore), new ObjRefStoreEnhancementHint(entityType, idIndex));
         objRefConstructorDelegate = AccessorTypeProvider.GetConstructorType <IObjRefStoreFactory>(enhancedType);
         constructorDelegateMap.Put(entityType, idIndex, objRefConstructorDelegate);
         return(objRefConstructorDelegate);
     }
 }