public override IEnumerable <TEntity> Go() { using (var reader = StatementExecutor.ExecuteReader(Sql())) { return(EntityMapper.Map <TEntity>(reader)); } }
public List <TEntity> ListGo() { using (var reader = StatementExecutor.ExecuteReader(Sql())) { return(EntityMapper.MapList <TEntity>(reader)); } }
public TLEntity ListEntityGo <TLEntity>() where TLEntity : List <TEntity>, new() { using (var reader = StatementExecutor.ExecuteReader(Sql())) { return(EntityMapper.MapEntityList <TLEntity, TEntity>(reader)); } }
public override int Go() { if (string.IsNullOrWhiteSpace(Sql)) { throw new MissingSqlException(); } return(StatementExecutor.ExecuteNonQuery(Sql)); }
public override int Go() { if (paramSetMode) { throw new InvalidOperationException("For cannot be used ParamSet have been used, please create a new command."); } return(StatementExecutor.ExecuteNonQuery(Sql())); }
public IEnumerable <TEntity> Union(List <UnionSql> Sqls) { if (Sqls.Count() == 0) { return(Go()); } using (IDataReader reader = StatementExecutor.ExecuteReader(UnionSql(Sqls))) return(EntityMapper.Map <TEntity>(reader)); }
public override IEnumerable <TEntity> Go() { if (string.IsNullOrWhiteSpace(Sql)) { throw new MissingSqlException(); } using (IDataReader reader = StatementExecutor.ExecuteReader(Sql)) return(entityMapper.Map <TEntity>(reader)); }
public override async Task <int> GoAsync() { if (string.IsNullOrWhiteSpace(Sql)) { throw new MissingSqlException(); } var num = await StatementExecutor.ExecuteNonQueryAsync(Sql); return(num); }
public async Task <TLEntity> ListEntityGoAsync <TLEntity>() where TLEntity : List <TEntity>, new() { TLEntity lentity; using (var reader = await StatementExecutor.ExecuteReaderAsync(Sql())) { lentity = EntityMapper.MapEntityList <TLEntity, TEntity>(reader); } return(lentity); }
public async Task <List <TEntity> > ListGoAsync() { List <TEntity> entityList; using (var reader = await StatementExecutor.ExecuteReaderAsync(Sql())) { entityList = EntityMapper.MapList <TEntity>(reader); } return(entityList); }
public override async Task <IEnumerable <TEntity> > GoAsync() { IEnumerable <TEntity> entities; using (var reader = await StatementExecutor.ExecuteReaderAsync(Sql())) { entities = EntityMapper.Map <TEntity>(reader); } return(entities); }
public async Task <IEnumerable <TEntity> > UnionAsync(List <UnionSql> Sqls) { if (Sqls.Count() == 0) { return(Go()); } using (var reader = await StatementExecutor.ExecuteReaderAsync(UnionSql(Sqls))) { return(EntityMapper.Map <TEntity>(reader)); } }
public override int Go() { if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var name = "[" + SchemaName + "].[" + ProcedureName + "]"; return(ParameterDefinitions.Any() ? StatementExecutor.ExecuteNonQueryStoredProcedure(name, ParameterDefinitions.ToArray()) : StatementExecutor.ExecuteNonQueryStoredProcedure(name)); }
public override async Task <TEntity> GoAsync() { if (IsAutoIncrement) { using (var reader = await StatementExecutor.ExecuteReaderAsync(Sql())) { return(EntityMapper.Map <TEntity>(reader).FirstOrDefault()); } } var num = await StatementExecutor.ExecuteNonQueryAsync(Sql()); return(entity); }
public override async Task <IEnumerable <TEntity> > GoAsync() { if (string.IsNullOrWhiteSpace(Sql)) { throw new MissingSqlException(); } IEnumerable <TEntity> entities; using (var reader = await StatementExecutor.ExecuteReaderAsync(Sql)) { entities = entityMapper.Map <TEntity>(reader); } return(entities); }
public override TEntity Go() { if (paramWithMode) { throw new InvalidOperationException("For cannot be used ParamWith have been used, please create a new command."); } if (IsAutoIncrement) { using (IDataReader reader = StatementExecutor.ExecuteReader(Sql())) return(EntityMapper.Map <TEntity>(reader).FirstOrDefault()); } StatementExecutor.ExecuteNonQuery(Sql()); return(entity); }
public override void process(ICode iCode, SymbolTableStack symbolTableStack) { this.symbolTableStack = symbolTableStack; this.iCode = iCode; long startTime = DateTime.Now.Ticks; ICodeNode rootNode = iCode.GetRoot(); StatementExecutor statementExecutor = new StatementExecutor(this); statementExecutor.Execute(rootNode); float elapsedTime = (DateTime.Now.Ticks - startTime) / 1000f; int runtimeErrors = RuntimeErrorHandler.errorCount; sendMessage(new Message(MessageType.INTERPRETER_SUMMARY, new Object[] { executionCount, runtimeErrors, elapsedTime })); }
public override IEnumerable <TEntity> Go() { if (string.IsNullOrWhiteSpace(ProcedureName)) { ProcedureName = CustomAttributeHandle.DbTableName <TEntity>(); } if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var name = "[" + SchemaName + "].[" + ProcedureName + "]"; using (var reader = ParameterDefinitions.Any() ? StatementExecutor.ExecuteStoredProcedure(name, ParameterDefinitions.ToArray()) : StatementExecutor.ExecuteStoredProcedure(name)) return(_entityMapper.Map <TEntity>(reader)); }
public void ExecuteQueryUsingProvidedConnection() { var statementExecutor = new StatementExecutor(this.logger, this.target); const string Sql = "SELECT * FROM Test"; var rowsCount = 0; using (var reader = statementExecutor.ExecuteReader(Sql)) { while (reader.Read()) { rowsCount++; } } rowsCount.Should() .Be(4); }
public override int GetPageCount() { FinalizeColumnSpecifications(); FinalizeJoinConditions(); FinalizeWhereConditions(Specification.Filters); FinalizeGroupings(); FinalizeOrderings(); FinalizeHavings(); using (var dataReader = StatementExecutor.ExecuteReader(Specification.GetCountSqlString())) { var num = 0; if (dataReader.Read()) { num = dataReader.GetInt32(0); } return(num); } }
public async Task <TLEntity> ListEntityGoAsync <TLEntity>() where TLEntity : List <TEntity>, new() { IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(Sql()); IDataReader reader = dataReader; dataReader = null; TLEntity lentity; try { lentity = EntityMapper.MapEntityList <TLEntity, TEntity>(reader); } finally { reader?.Dispose(); } return(lentity); }
public override async Task <IEnumerable <TEntity> > GoAsync() { IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(Sql()); IDataReader reader = dataReader; dataReader = null; IEnumerable <TEntity> entities; try { entities = EntityMapper.Map <TEntity>(reader); } finally { reader?.Dispose(); } return(entities); }
public async Task <List <TEntity> > ListEntityGoAsync() { IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(Sql()); IDataReader reader = dataReader; dataReader = null; List <TEntity> entityList; try { entityList = EntityMapper.MapList <TEntity>(reader); } finally { reader?.Dispose(); } return(entityList); }
public override async Task <int> GoAsync() { if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var procedureName = "[" + SchemaName + "].[" + ProcedureName + "]"; int num; if (ParameterDefinitions.Any()) { num = await StatementExecutor.ExecuteNonQueryStoredProcedureAsync(procedureName, ParameterDefinitions.ToArray()); } else { num = await StatementExecutor.ExecuteNonQueryStoredProcedureAsync(procedureName); } return(num); }
public async Task <IEnumerable <TEntity> > UnionAsync(List <UnionSql> Sqls) { if (Sqls.Count() == 0) { return(Go()); } IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(UnionSql(Sqls)); IDataReader reader = dataReader; dataReader = null; try { return(EntityMapper.Map <TEntity>(reader)); } finally { reader?.Dispose(); } }
public override async Task <TEntity> GoAsync() { if (IsAutoIncrement) { IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(Sql()); IDataReader reader = dataReader; dataReader = null; try { return(EntityMapper.Map <TEntity>(reader).FirstOrDefault()); } finally { reader?.Dispose(); } } int num = await StatementExecutor.ExecuteNonQueryAsync(Sql()); return(entity); }
public override async Task <IEnumerable <TEntity> > GoAsync() { if (string.IsNullOrWhiteSpace(ProcedureName)) { ProcedureName = CustomAttributeHandle.DbTableName <TEntity>(); } if (string.IsNullOrWhiteSpace(ProcedureName)) { throw new MissingProcedureNameException(); } var procedureName = "[" + SchemaName + "].[" + ProcedureName + "]"; IDataReader dataReader; if (ParameterDefinitions.Any()) { dataReader = await StatementExecutor.ExecuteStoredProcedureAsync(procedureName, ParameterDefinitions.ToArray()); } else { dataReader = await StatementExecutor.ExecuteStoredProcedureAsync(procedureName); } var reader = dataReader; dataReader = null; IEnumerable <TEntity> entities; try { entities = entityMapper.Map <TEntity>(reader); } finally { reader?.Dispose(); } return(entities); }
public override async Task <IEnumerable <TEntity> > GoAsync() { if (string.IsNullOrWhiteSpace(Sql)) { throw new MissingSqlException(); } IDataReader dataReader = await StatementExecutor.ExecuteReaderAsync(Sql); IDataReader reader = dataReader; dataReader = null; IEnumerable <TEntity> entities; try { entities = entityMapper.Map <TEntity>(reader); } finally { reader?.Dispose(); } return(entities); }
public ISqlStatement <TResult> UseConnectionProvider(IConnectionProvider connectionProvider) { StatementExecutor.UseConnectionProvider(connectionProvider); return(this); }
public override async Task <int> GoAsync() { int num = await StatementExecutor.ExecuteNonQueryAsync(Sql()); return(num); }