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]);
            }
        }
Beispiel #2
0
 public ColumnReader(FastDatabase db, string type)
 {
     this.db     = db;
     this.type   = type;
     Type        = GetType(type);
     currentRead = getCurrentRead(type);
 }
Beispiel #3
0
 public ForeignKeyReader(FastDatabase db, Type referencedType)
 {
     this.db         = db;
     referencedTable = db.GetTable(referencedType);
     if (referencedTable == null)
     {
         referencedTable = new EmptyTable <Entity>();
     }
     Type = referencedType;
 }
Beispiel #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();
        }
Beispiel #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);
            }
        }
Beispiel #6
0
 public virtual ITable Clone(FastDatabase dbm)
 {
     throw new NotImplementedException();
 }
Beispiel #7
0
 protected Table(FastDatabase dbm)
 {
     Info   = new TableInfo(this, dbm);
     DBM    = dbm;
     Loaded = new Task(() => { });
 }
Beispiel #8
0
 public AccessTable(FastDatabase dbm) : base(dbm)
 {
 }
Beispiel #9
0
 public FetchTable(FastDatabase dbm) : base(dbm)
 {
 }
Beispiel #10
0
 public LoadedTable(FastDatabase dbm) : base(dbm)
 {
 }