public virtual Task <T> ExecuteAsync <T>(IDbAction <T> command, CancellationToken token) { using (var connection = new SqliteConnection(_connectionString)) { return(command.ExecuteAsync(connection, token)); } }
public virtual T Execute <T>(IDbAction <T> command) { using (var connection = new SqliteConnection(_connectionString)) { return(command.Execute(connection)); } }
public static void ToEntry(ActionModel actionModel, IDbAction actionEntry) { actionEntry.Id = actionModel.Id; actionEntry.Description = actionModel.Description; actionEntry.Name = actionModel.Name; actionEntry.Presentation.Visibility = actionModel.Visibility; actionEntry.Presentation.Color = ColorToHex(actionModel.Color); }
public void Add_WhenHaveNoEmail() { IDbAction sut = GetInMemoryDbRepository(); Assert.Equal(1, sut.GetFlats(0, 10).First().Id); var flat = sut.GetFlatById(1); Assert.NotNull(flat); Assert.Equal(3500000m, flat.Price); Assert.Equal(2, sut.GetFlats(0, 10).Count()); }
public static int Save(this IDbAction action, SqlConnection connection, SqlTransaction transaction = null) { var D = action.Insert; var command = new SqlCommand(D.Key, connection); if (transaction != null) { command.Transaction = transaction; } command.Parameters.AddRange(D.Value); return(command.ExecuteNonQuery()); }
public static int Save(this IDbAction action, string connectionString) { int result = 0; var D = action.Insert; using (var connection = new SqlConnection(connectionString)) { connection.Open(); var command = new SqlCommand(D.Key, connection); command.Parameters.AddRange(D.Value); result = command.ExecuteNonQuery(); connection.Close(); } return(result); }
// 組合 DBAction 的總清單 private DbActionResource(DBObject.DataBase dataBase, IDbAction dbAction) { DataBase = dataBase; DbAction = dbAction; }
public HomeController(IDbAction db) { dbAction = db; }