예제 #1
0
        public void Create_A_new_Connection_ConventionBased()
        {
            var creator = new NameConventionDbConnectionCreator("System.Data.SqlClient");
            var connection = creator.Create();

            Assert.IsNotNull(connection);
        }
예제 #2
0
        public void FullEntityLoader_Employees()
        {
            using (var con = new NameConventionDbConnectionCreator("System.Data.SqlClient").Create())
            {
                con.Open();

                var employee = new Employee();

                var cmd = con.CreateCommand();
                cmd.CommandText = Utils.EmployeeTable.CommandsHolder.Select;

                var reader = cmd.ExecuteReader();

                Assert.IsNotNull(reader);
                Assert.IsTrue(reader.Read());

                new FullEntityLoader(new CachedEntities()).Load(employee, null, reader);

                reader.Close();

                EntitiesAsserts.Assert_Employee_1(employee);
            }
        }
예제 #3
0
파일: Utils.cs 프로젝트: stalinvr007/VoDB
 public static void ExecuteWith(Action<DbConnection> action)
 {
     using (var con = new NameConventionDbConnectionCreator("System.Data.SqlClient").Create())
     {
         con.Open();
         try
         {
             action(con);
         }
         finally
         {
             con.Close();
         }
     }
 }