示例#1
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);
            }
        }
示例#2
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();
         }
     }
 }