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