コード例 #1
0
ファイル: SqlDbLoader.cs プロジェクト: tadeuspiat/legacy
 public SqlDbLoader(PersistentStorage ps, Type entityType, SqlConnection connection)
 {
     _entityType = entityType;
     _connection = connection;
     _mapper     = new Mapper(_entityType);
     _ps         = ps;
 }
コード例 #2
0
            public EntityFieldsMapper(Type entityType, PersistentStorage ps)
            {
                _ps = ps;
                ObjectDescription od = ClassFactory.GetObjectDescription(entityType, ps);

                foreach (PropertyDescription prop in od.Properties)
                {
                    string             dbPropName = "";
                    FieldNameAttribute attr       = prop.GetAttribute <FieldNameAttribute>();
                    if (attr == null)
                    {
                        dbPropName = prop.Name;
                    }
                    else if (prop.ReflectedObject.GetAttribute <IdFieldNameAttribute>() != null &&
                             prop.ReflectedObject.GetAttribute <IdFieldNameAttribute>().Name == prop.Name)
                    {
                        dbPropName = prop.ReflectedObject.GetAttribute <IdFieldNameAttribute>().Name;
                    }
                    else
                    {
                        dbPropName = attr.FieldName;
                    }
                    _entityFieldsMapping.Add(prop.Name, dbPropName);
                    _entityFieldsMappingInverse.Add(dbPropName, prop.Name);
                }
            }
コード例 #3
0
 public static void DeletePersistentStorage(string key)
 {
     lock (_ps)
     {
         PersistentStorage ps = _ps[key];
         ps.Dispose();
         _ps.Remove(key);
     }
 }
コード例 #4
0
 public static ObjectDescription GetObjectDescription(Type type, PersistentStorage ps)
 {
     lock (_metaObjects)
     {
         if (!_metaObjects.ContainsKey(type.ToString()))
         {
             _metaObjects.Add(type.ToString(), new ObjectDescription(type, ps));
         }
         return(_metaObjects[type.ToString()]);
     }
 }
コード例 #5
0
 public static object CreateObject(Type type, PersistentStorage ps, params object[] args)
 {
     lock (_metaObjects)
     {
         if (!_metaObjects.ContainsKey(type.ToString()))
         {
             _metaObjects.Add(type.ToString(), new ObjectDescription(type, ps));
         }
         return(_metaObjects[type.ToString()].CreateObject(args));
     }
 }
コード例 #6
0
 public static T CreateObject <T>(PersistentStorage ps, params object[] args)
 {
     lock (_metaObjects)
     {
         if (!_metaObjects.ContainsKey(typeof(T).ToString()))
         {
             _metaObjects.Add(typeof(T).ToString(), new ObjectDescription(typeof(T), ps));
         }
         T o = (T)_metaObjects[typeof(T).ToString()].CreateObject(args);
         (o as EntityBase).CreatorPs = ps;
         return(o);
     }
 }
コード例 #7
0
        public Mapper(Type entityType, PersistentStorage ps)
        {
            _ps                 = ps;
            _entityType         = entityType;
            _entityFieldsMapper = new EntityFieldsMapper(EntityType, _ps);
            TableAttribute attr = ClassFactory.GetObjectDescription(_entityType, ps).DbTableAttribute;

            if (attr == null)
            {
                _tableName = entityType.Name;
            }
            else
            {
                _tableName = attr.TableName;
            }
            DbSchemaAttribute attr2 = ClassFactory.GetObjectDescription(_entityType, ps).GetAttribute <DbSchemaAttribute>();

            if (attr2 != null)
            {
                _schemaName = attr2.SchemaName;
            }
        }
コード例 #8
0
 public MsSqlStorageAccessMediator(PersistentStorage ps, SqlConnection connection)
 {
     _connection   = connection;
     _mediatorType = StorageAccessMediatorType.MsSql;
     _ps           = ps;
 }
コード例 #9
0
 public static FacadeBuilder GetFacadeBuilder(Type entityType, PersistentStorage ps)
 {
     return(ps.GetFacadeBuilder(entityType));
 }
コード例 #10
0
ファイル: CachesContainer.cs プロジェクト: tadeuspiat/legacy
 public CachesContainer(PersistentStorage ps)
 {
     _ps = ps;
 }
コード例 #11
0
ファイル: FacadeBuilder.cs プロジェクト: tadeuspiat/legacy
 public FacadeBuilder(Type entityType, PersistentStorage ps, string outputFileName)
 {
     _ps         = ps;
     _facadeType = entityType;
     Build(outputFileName);
 }
コード例 #12
0
ファイル: FacadeBuilder.cs プロジェクト: tadeuspiat/legacy
 public FacadeBuilder(Type entityType, PersistentStorage ps)
 {
     _ps         = ps;
     _facadeType = entityType;
     Build(null);
 }