Esempio n. 1
0
        public MetaDataInterpreter(Stream fileStream, FastDatabase dbm)
        {
            List <string[]> lines = new List <string[]>();

            using (StreamReader reader = new StreamReader(fileStream))
            {
                string line = null;
                while ((line = reader.ReadLine()) != null)
                {
                    lines.Add(line.Split(';'));
                }
            }

            this.dbm   = dbm;
            this.lines = lines;
            this.types = lines.Select(lin => Type.GetType(ConvertNamespace(lin[1])) ?? typeof(object)).ToArray();
            for (int i = 0; i < types.Length; i++)
            {
                if (types[i] != typeof(object))
                {
                    fileNames.Add(types[i], lines[i][1]);
                }
            }

            foreach (Type type in types.Where(t => t != typeof(object)))
            {
                Add(type, new FieldReader[0]);
            }
        }
Esempio n. 2
0
 public ColumnReader(FastDatabase db, string type)
 {
     this.db     = db;
     this.type   = type;
     Type        = GetType(type);
     currentRead = getCurrentRead(type);
 }
Esempio n. 3
0
 public ForeignKeyReader(FastDatabase db, Type referencedType)
 {
     this.db         = db;
     referencedTable = db.GetTable(referencedType);
     if (referencedTable == null)
     {
         referencedTable = new EmptyTable <Entity>();
     }
     Type = referencedType;
 }
Esempio n. 4
0
        public TableInfo(ITable table, FastDatabase db)
        {
            this.db    = db;
            EntityType = table.GetType().GetGenericArguments()[0];

            var properties = EntityType.GetProperties();

            Columns          = properties.Where(p => p.GetCustomAttributes <Column>(true).Any()).ToArray();
            Keys             = properties.Where(p => p.GetCustomAttributes <ForeignKey>(true).Any()).ToArray();
            ReferenceSources = properties.Where(p => p.GetCustomAttributes <MultiReference>(true).Any()).ToArray();
        }
Esempio n. 5
0
        public MultiKeyReader(FastDatabase db)
        {
            this.db         = db;
            referencedTable = db.GetTable(typeof(TSource));
            this.Type       = typeof(TSource);

            var postSetProp = typeof(TSource).GetProperties().SingleOrDefault(p => ForeignKey.Is(p) && ForeignKey.IsPostSet(p));

            if (postSetProp != null)
            {
                postSetter = TableInfo.BuildSetAccessor(postSetProp.SetMethod);
            }
        }
Esempio n. 6
0
 public virtual ITable Clone(FastDatabase dbm)
 {
     throw new NotImplementedException();
 }
Esempio n. 7
0
 protected Table(FastDatabase dbm)
 {
     Info   = new TableInfo(this, dbm);
     DBM    = dbm;
     Loaded = new Task(() => { });
 }
Esempio n. 8
0
 public AccessTable(FastDatabase dbm) : base(dbm)
 {
 }
Esempio n. 9
0
 public FetchTable(FastDatabase dbm) : base(dbm)
 {
 }
Esempio n. 10
0
 public LoadedTable(FastDatabase dbm) : base(dbm)
 {
 }