public DbCommandInfo BuildCommand(DbSqlBuilder dbSqlBuilder, EntityCommand entityCommand) { switch(entityCommand.Kind) { case EntityCommandKind.SelectAll: return dbSqlBuilder.BuildSelectAllCommand(entityCommand); case EntityCommandKind.SelectAllPaged: return dbSqlBuilder.BuildSelectAllPagedCommand(entityCommand); case EntityCommandKind.SelectByKey: return dbSqlBuilder.BuildSelectByKeyCommand(entityCommand); case EntityCommandKind.SelectByKeyArray: return dbSqlBuilder.BuildSelectByKeyArrayCommand(entityCommand); case EntityCommandKind.SelectByKeyManyToMany: return dbSqlBuilder.BuildSelectManyToManyCommand(entityCommand); case EntityCommandKind.Insert: return dbSqlBuilder.BuildSqlInsertCommand(entityCommand); case EntityCommandKind.Update: case EntityCommandKind.PartialUpdate: return dbSqlBuilder.BuildSqlUpdateCommand(entityCommand); case EntityCommandKind.Delete: return dbSqlBuilder.BuildSqlDeleteCommand(entityCommand); default: // it is custom command - should be compiled on the fly return null; } }
public DbModel Build() { // create model _dbModel = new DbModel(_entityModel.App, _config); _dbSqlBuilder = _driver.CreateDbSqlBuilder(_dbModel); _driver.OnDbModelConstructing(_dbModel); BuildTables(); CreateTableKeys(); SetupOrderBy(); //ref constraints are created in a separate loop, after creating PKs BuildRefConstraints(); CheckObjectNames(); CompileViews(); BuildCrudCommands(); BuildSequences(); _driver.OnDbModelConstructed(_dbModel); CheckErrors(); return _dbModel; }