Beispiel #1
0
        protected EntityFactoryConstructor GetConstructorEntry(Type entityType)
        {
            EntityFactoryConstructor constructor = typeToConstructorMap.Get(entityType);

            if (constructor == null)
            {
                try
                {
                    EntityFactoryWithArgumentConstructor argumentConstructor = AccessorTypeProvider.GetConstructorType <EntityFactoryWithArgumentConstructor>(entityType);
                    constructor = new EntityFactoryToArgumentConstructor(argumentConstructor, Self);
                }
                catch (Exception)
                {
                    constructor = AccessorTypeProvider.GetConstructorType <EntityFactoryConstructor>(entityType);
                }
                typeToConstructorMap.Put(entityType, constructor);
            }
            return(constructor);
        }
Beispiel #2
0
 protected Object CreateEntityIntern(IEntityMetaData metaData, bool doEmptyInit)
 {
     try
     {
         if (metaData.EnhancedType == null)
         {
             EntityMetaDataRefresher.RefreshMembers(metaData);
         }
         EntityFactoryConstructor constructor = GetConstructorEntry(metaData.EnhancedType);
         Object entity = constructor.CreateEntity();
         PostProcessEntity(entity, metaData);
         return(entity);
     }
     catch (Exception e)
     {
         if (BytecodePrinter != null)
         {
             throw RuntimeExceptionUtil.Mask(e, BytecodePrinter.ToPrintableBytecode(metaData.EnhancedType));
         }
         throw;
     }
 }