当前位置: 首页>>代码示例>>C#>>正文


C# IEmployeeRepository.Find方法代码示例

本文整理汇总了C#中IEmployeeRepository.Find方法的典型用法代码示例。如果您正苦于以下问题:C# IEmployeeRepository.Find方法的具体用法?C# IEmployeeRepository.Find怎么用?C# IEmployeeRepository.Find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEmployeeRepository的用法示例。


在下文中一共展示了IEmployeeRepository.Find方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestTransaction_SameContext

 public void TestTransaction_SameContext() {
     try {
         _context.Start();
         _employeeRepository.Add( _employee );
         throw new Exception();
         _departmentRepository.Add( _department );
         _context.Commit();
     }
     catch {
         _employeeRepository = Ioc.Create<IEmployeeRepository>();
         Assert.IsNull( _employeeRepository.Find( _employee.Id ) );
     }
 }
开发者ID:NetUtil,项目名称:Util,代码行数:13,代码来源:SingleDbTest.cs

示例2: TestRemove_Id

        public void TestRemove_Id() {
            //添加
            _employeeRepository.Add( _employee );

            //标识查找
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            Assert.IsNotNull( _employeeRepository.Find( _employee.Id ) );

            //移除
            _employeeRepository.Remove( _employee.Id );

            //索引器查找
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            Assert.IsNull( _employeeRepository[_employee.Id] );
        }
开发者ID:NetUtil,项目名称:Util,代码行数:15,代码来源:GuidEntityTest.cs

示例3: TestTransaction_DifferentContext_AllFail

 public void TestTransaction_DifferentContext_AllFail() {
     _departmentRepository = new DepartmentRepository( Helper.GetEfContext() );
     try {
         using ( TransactionScope scope = new TransactionScope() ) {
             _employeeRepository.Add( _employee );
             throw new Exception();
             _departmentRepository.Add( _department );
             scope.Complete();
         }
     }
     catch {
         _employeeRepository = Ioc.Create<IEmployeeRepository>();
         Assert.IsNull( _employeeRepository.Find( _employee.Id ) );
     }
 }
开发者ID:NetUtil,项目名称:Util,代码行数:15,代码来源:SingleDbTest.cs

示例4: TestUpdate_1

        public void TestUpdate_1() {
            //添加
            _employeeRepository.Add( _employee );

            //标识查找
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            _employee = _employeeRepository.Find( _employee.Id );

            //修改并提交
            _employee.Name = "A";
            _employeeRepository.Save();

            //标识查找
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            _employee = _employeeRepository.Find( _employee.Id );

            //验证
            Assert.AreEqual( "A", _employee.Name );
        }
开发者ID:NetUtil,项目名称:Util,代码行数:19,代码来源:GuidEntityTest.cs

示例5: TestTransaction_AllFail

 public void TestTransaction_AllFail() {
     try {
         using( TransactionScope scope = new TransactionScope() ) {
             _context.Start();
             _employeeRepository.Add( _employee );
             _departmentRepository.Add( _department );
             _context.Commit();
             throw new Exception();
             _employeeRepository2.Add( _employee2 );
             scope.Complete();
         }
     }
     catch {
         _employeeRepository = Ioc.Create<IEmployeeRepository>();
         Assert.IsNull( _employeeRepository.Find( _employee.Id ) );
     }
 }
开发者ID:NetUtil,项目名称:Util,代码行数:17,代码来源:MultiDbTest.cs

示例6: TestTransaction_AllSuccess

 public void TestTransaction_AllSuccess() {
     using ( TransactionScope scope = new TransactionScope() ) {
         _context.Start();
         _employeeRepository.Add( _employee );
         _departmentRepository.Add( _department );
         _context.Commit();
         _employeeRepository2.Add( _employee2 );
         scope.Complete();
     }
     _employeeRepository = Ioc.Create<IEmployeeRepository>();
     Assert.IsNotNull( _employeeRepository.Find( _employee.Id ) );
     _employeeRepository2 = new EmployeeRepository( Helper.GetEfContext2() );
     Assert.IsNotNull( _employeeRepository2.Find( _employee2.Id ) );
 }
开发者ID:NetUtil,项目名称:Util,代码行数:14,代码来源:MultiDbTest.cs

示例7: TestUpdate_2

        public void TestUpdate_2() {
            //添加
            _employeeRepository.Add( _employee );

            //创建新对象并附加
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            _employee = _employee.Copy();
            _employee.Name = "A";
            _employeeRepository.Update( _employee );

            //标识查找
            _employeeRepository = Ioc.Create<IEmployeeRepository>();
            _employee = _employeeRepository.Find( _employee.Id );

            //验证
            Assert.AreEqual( "A", _employee.Name );
        }
开发者ID:NetUtil,项目名称:Util,代码行数:17,代码来源:GuidEntityTest.cs

示例8: TestTransaction_DifferentContext_AllSuccess

 public void TestTransaction_DifferentContext_AllSuccess() {
     _departmentRepository = new DepartmentRepository( Helper.GetEfContext() );
     using ( TransactionScope scope = new TransactionScope() ) {
         _employeeRepository.Add( _employee );
         _departmentRepository.Add( _department );
         scope.Complete();
     }
     _employeeRepository = Ioc.Create<IEmployeeRepository>();
     Assert.IsNotNull( _employeeRepository.Find( _employee.Id ) );
     _departmentRepository = Ioc.Create<IDepartmentRepository>();
     Assert.IsNotNull( _departmentRepository.Find( _department.Id ) );
 }
开发者ID:NetUtil,项目名称:Util,代码行数:12,代码来源:SingleDbTest.cs


注:本文中的IEmployeeRepository.Find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。