protected IEntityTable <T> GetTable <T>() where T : class { string tableId = this.provider.Mapping.GetTableId(typeof(T)); IEntityTable <T> table = this.provider.GetTable <T>(tableId); return(new DbEntityTable <T>(table)); }
public SessionTable(EntitySession session, MappingEntity entity) : base(session.sessionProvider, typeof(ISessionTable <T>)) { this.session = session; this.entity = entity; this.underlyingTable = this.session.Provider.GetTable <T>(entity.EntityId); }
public DbEntityTable(IEntityTable <T> entityTable) { if (entityTable == null) { throw new ArgumentNullException("entityTable"); } this.entityTable = entityTable; }
public SessionTable(EntitySession session, MappingEntity entity) : base(session.sessionProvider, typeof(ISessionTable <T>)) { this.session = session; this.entity = entity; // Changed the class so that the underlyingTable is of type DbEntityTable. var table = this.session.Provider.GetTable <T>(entity.TableId); this.underlyingTable = new DbEntityTable <T>(table); }
private string GetTableName <T>(IEntityTable <T> entityTable) { var advancedMapping = Mapping as VfpAdvancedMapping; if (advancedMapping == null) { return(entityTable.TableId); } return(advancedMapping.GetTableName(advancedMapping.GetEntity(typeof(T), entityTable.TableId))); }
protected DbEntityInserterBase(IEntityTable <T> entityTable, DbEntityProvider provider) { if (entityTable == null) { throw new ArgumentNullException("entityTable"); } this.entityTable = entityTable; if (provider != null) { this.mappingEntity = provider.Mapping.GetEntity(this.entityType); this.primaryKey = this.GetPrimaryKey(provider); } this.func = this.GetFunction(); }
public DataBase(string file) { bool needsInit = false; _filestream = File.Open(file, System.IO.FileMode.OpenOrCreate); if (_filestream.Length == 0) { needsInit = true; } _db = new LiteDatabase(_filestream); Todo = new Implementation.ToDo(_db.GetCollection <ToDoItem>(CollectionNames.Todo)); FavoriteFolders = new Implementation.FavoriteFolders(_db.GetCollection <FolderLink>(CollectionNames.FavoriteFolders)); VirtualFolders = new Implementation.VirtualFolders(_db.GetCollection <VirtualFolder>(CollectionNames.VirtualFolders)); Programs = new Implementation.Programs(_db.GetCollection <LauncherProgram>(CollectionNames.Programs)); Notes = new Implementation.Notes(_db.GetCollection <Note>(CollectionNames.Notes)); StoredFiles = new Implementation.StoredFiles(_db); MediaLibary = new Implementation.MediaLibary(_db.GetCollection <Song>(CollectionNames.Songs), _db.GetCollection <RadioStation>(CollectionNames.Radios), _db.GetCollection <SongQuery>(CollectionNames.Queries), StoredFiles); Podcasts = new Implementation.Podcasts(_db.GetCollection <PodcastUri>(CollectionNames.Podcasts)); if (needsInit) { DataBaseInitializer.Init(this); } }
private Expression BindUpdate(IEntityTable upd, Expression instance, LambdaExpression updateCheck, LambdaExpression resultSelector, ColumnIndeedExpression columnsToBeHandled) { MappingEntity entity = this.mapper.Mapping.GetEntity(instance.Type, upd.TableId); return this.Visit(this.mapper.GetUpdateExpression(entity, instance, updateCheck, resultSelector, columnsToBeHandled, null)); }
private Expression BindInsert(IEntityTable upd, Expression instance, LambdaExpression selector, ColumnIndeedExpression columnsToBeHandled) { MappingEntity entity = this.mapper.Mapping.GetEntity(instance.Type, upd.TableId); return this.Visit(this.mapper.GetInsertExpression(entity, instance, selector, columnsToBeHandled)); }
private Expression BindBatch(IEntityTable upd, Expression instances, LambdaExpression operation, Expression batchSize, Expression stream) { var save = this.batchUpd; this.batchUpd = upd; var op = (LambdaExpression)this.Visit(operation); this.batchUpd = save; var items = this.Visit(instances); var size = this.Visit(batchSize); var str = this.Visit(stream); return new BatchExpression(items, op, size, str); }
private Expression BindDelete(IEntityTable upd, Expression instance, LambdaExpression deleteCheck) { MappingEntity entity = this.mapper.Mapping.GetEntity(instance != null ? instance.Type : deleteCheck.Parameters[0].Type, upd.TableId); return this.Visit(this.mapper.GetDeleteExpression(entity, instance, deleteCheck)); }
private Expression BindInsertOrUpdate(IEntityTable upd, Expression instance, LambdaExpression updateCheck, LambdaExpression resultSelector) { MappingEntity entity = this.mapper.Mapping.GetEntity(instance.Type, upd.TableId); return this.Visit(this.mapper.GetInsertOrUpdateExpression(entity, instance, updateCheck, resultSelector)); }
public DbEntityInserter(IEntityTable <T> entityTable, DbEntityProvider provider) : base(entityTable, provider) { }
public void Zap <T>(IEntityTable <T> entityTable) { ExecuteNonQuery(string.Format("EXECSCRIPT([USE {0} IN SELECT (0) EXCLUSIVE] + CHR(13) + [ZAP] + CHR(13) + [CLOSE TABLES ALL])", GetTableName(entityTable))); }