static void Main4(string[] args) { Console.WriteLine("Testing ExecuteValues function"); ISqlSimpleAccess simpleAccess = new SqlSimpleAccess("sqlDefaultConnection"); SqlTransaction transaction = null; try { var data = simpleAccess.ExecuteValues <string>("Select Name from Category;"); using (transaction = simpleAccess.BeginTrasaction()) { data = simpleAccess.ExecuteValues <string>(transaction, "Select Name from Category;"); simpleAccess.EndTransaction(transaction); } } catch (Exception e) { simpleAccess.EndTransaction(transaction, false); throw; } Console.WriteLine("Press any key to close."); Console.ReadKey(); }
static void Main2(string[] args) { ConstructorTests(); ISqlSimpleAccess simpleAccess = new SqlSimpleAccess("defaultConnection"); SqlTransaction transaction = null; try { using (transaction = simpleAccess.BeginTrasaction()) { var person = new Person() { Name = "Ahmed", Address = "Madina" }; var newId = simpleAccess.ExecuteScalar <int>(transaction, "INSERT INTO People Values (@name, @Address); SELECT SCOPE_IDENTITY();", person); simpleAccess.EndTransaction(transaction); } } catch (Exception) { simpleAccess.EndTransaction(transaction, false); throw; } //TestTextCommandSimpleAccess(GetTextQuerySimpleAccess()); //TestSotredProcedureCommandSimpleAccess(GetStroedProcedureSimpleAccess()); TestSotredProcedureCommandSimpleAccessRepository(); Console.WriteLine("Press any key to close."); Console.ReadKey(); }