/// <summary> /// Executes the <see cref="SqlText"/>. /// </summary> /// <param name="sqlExecute"></param> /// <param name="sqlText"></param> /// <returns></returns> public static int Execute(this ISqlExecute sqlExecute, SqlText sqlText) { string sql = sqlText.Sql(); if (string.IsNullOrEmpty(sql)) { return(0); } return(sqlExecute.Execute(sql, sqlText.Parameters, CommandType.Text)); }
public void Execute_excutes_with_arguments() { ISqlExecute sqlExecute = A.Fake <ISqlExecute>(); SqlText sqlText = A.Fake <SqlText>(); ParameterCollection parameters = new ParameterCollection(); const string sql = "select 1"; A.CallTo(() => sqlText.Sql()).Returns(sql); A.CallTo(() => sqlText.Parameters).Returns(parameters); sqlExecute.Execute(sqlText); A.CallTo(() => sqlExecute.Execute(sql, parameters, CommandType.Text, null)).MustHaveHappenedOnceExactly(); }
public SqlExecutions(ISqlExecute <TEntity> add, ISqlExecute <TEntity> delete, ISqlExecute <TEntity> update, ISqlExecute <TEntity> unmodified) { //if (add == null) // throw new ArgumentNullException(nameof(add)); //if (delete == null) // throw new ArgumentNullException(nameof(delete)); //if (update == null) // throw new ArgumentNullException(nameof(update)); //if (unmodified == null) // throw new ArgumentNullException(nameof(unmodified)); Add = add; Delete = delete; Update = update; Unmodified = unmodified; }
public BaseTrackeable(TEntity entity, ISqlExecute <TEntity> sqlExecute) { SqlExecute = sqlExecute; Current = entity; }
public static void Begin(TestContext testContext) { sqlExecute = StartServiceTests.Container.Resolve <ISqlExecute>(); }
public DeletedTrackeable(TEntity entity, ISqlExecute <TEntity> sqlExecute) : base(entity, sqlExecute) { }
public UnmodifiedTrackeable(TEntity entity, ISqlExecute <TEntity> sqlExecute) : base(entity, sqlExecute) { }
/// <summary> /// ctor /// </summary> /// <param name="sqlExecute"></param> public DbContext(ISqlExecute sqlExecute) { this.sqlExecute = sqlExecute; }
/// <summary> /// 关闭数据库上下文 /// </summary> public void Dispose() { sqlExecute.Close(); sqlExecute = null; }