Example #1
0
 public SqlDbLoader(PersistentStorage ps, Type entityType, SqlConnection connection)
 {
     _entityType = entityType;
     _connection = connection;
     _mapper     = new Mapper(_entityType);
     _ps         = ps;
 }
Example #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);
                }
            }
Example #3
0
 public static void DeletePersistentStorage(string key)
 {
     lock (_ps)
     {
         PersistentStorage ps = _ps[key];
         ps.Dispose();
         _ps.Remove(key);
     }
 }
Example #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()]);
     }
 }
Example #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));
     }
 }
Example #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);
     }
 }
Example #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;
            }
        }
 public MsSqlStorageAccessMediator(PersistentStorage ps, SqlConnection connection)
 {
     _connection   = connection;
     _mediatorType = StorageAccessMediatorType.MsSql;
     _ps           = ps;
 }
Example #9
0
 public static FacadeBuilder GetFacadeBuilder(Type entityType, PersistentStorage ps)
 {
     return(ps.GetFacadeBuilder(entityType));
 }
Example #10
0
 public CachesContainer(PersistentStorage ps)
 {
     _ps = ps;
 }
Example #11
0
 public FacadeBuilder(Type entityType, PersistentStorage ps, string outputFileName)
 {
     _ps         = ps;
     _facadeType = entityType;
     Build(outputFileName);
 }
Example #12
0
 public FacadeBuilder(Type entityType, PersistentStorage ps)
 {
     _ps         = ps;
     _facadeType = entityType;
     Build(null);
 }