Пример #1
0
        private static void Main(string[] args)
        {
            User user = new User();
            Department dept = new Department();

            //创建在SQL Server环境下使用的数据对象
            IFactory factory = new SqlserverFactory();
            //创建在MySQL环境下使用的数据对象
            //IFactory factory = new MysqlFactory();

            IUser u = factory.CreateUser();
            u.Insert(user);
            u.GetUser(1);

            // IDepartment idept = factory.CreateDepartment();
            // idept.Insert(dept);
            // idept.GetDepartment(1);

            Console.ReadLine();
        }
 public void Insert(Department department)
 {
     Console.WriteLine("在SQL SERVER中给Department表增加一条记录");
 }
 public Department GetDepartment(int id)
 {
     Department dept = new Department();
     Console.WriteLine("在SQL SERVER中根据ID得到Department表一条记录");
     return dept;
 }