private static async Task GetAllBusinessEntities() { var repo = new BusinessEntityRepository(ConnectionString); var entities = await repo.GetAllAsync(); WriteLine(string.Join('\n', entities)); }
public UnitOfWork(ERPDatabaseEntities context) { this._context = context; BusinessEntityRepository = new BusinessEntityRepository(context); CultureRepository = new CultureRepository(context); GrantPermissionAdmin = new GrantPermissionAdmin(context); HRRepository = new HRRepository(context); }
public void GetBusinessEntityes_Test() { var context = Context(); context.BusinessEntities = Set(new BusinessEntity { BusinessEntityId = 2 }); context.People = Set(new Person() { BusinessEntityId = 2, FirstName = "FIRSTNAME", LastName = "LASTNAME" }); context.BusinessEntityAddresses = Set(new BusinessEntityAddress() { BusinessEntityId = 2, AddressId = 3 }); context.Addresses = Set(new Address() { AddressId = 3, City = "CITY", StateProvinceId = 4, }); context.StateProvinces = Set(new StateProvince() { StateProvinceId = 4, Name = "PROVINCE" }); var repo = new BusinessEntityRepository(context); var result = repo.GetBusinessEntities().ToArray(); Assert.IsTrue(result.Count() == 1); var ent = result[0]; Assert.IsTrue(ent.BusinessEntityId == 2); Assert.IsTrue(ent.ContactName == "FIRSTNAME LASTNAME"); Assert.IsTrue(ent.Addresses.Count() == 1); var adr = ent.Addresses.ElementAt(0); Assert.IsTrue(adr == "The glorious city of CITY of the wonderfull province of PROVINCE"); }
public AWUnitOfWork(AWContext context) { _context = context; Address = new AddressRepository(context); BusinessEntity = new BusinessEntityRepository(context); BusinessEntityAddress = new BusinessEntityAddressRepository(context); PersonPhone = new PersonPhoneRepository(context); StateProvince = new StateProvinceRepository(context); Customer = new CustomerRepository(context); SalesPerson = new SalesPersonRepository(context); SalesOrderHeader = new SalesOrderHeaderRepository(context); SalesOrderDetail = new SalesOrderDetailRepository(context); ShoppingCartItem = new ShoppingCartItemRepository(context); SalesTerritory = new SalesTerritoryRepository(context); Product = new ProductRepository(context); ProductCategory = new ProductCategoryRepository(context); ProductDescription = new ProductDescriptionRepository(context); ProductInventory = new ProductInventoryRepository(context); ProductListPriceHistory = new ProductListPriceHistoryRepository(context); ProductPhoto = new ProductPhotoRepository(context); ProductProductPhoto = new ProductProductPhotoRepository(context); Person = new PersonRepository(context); }