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


C# IUnitOfWorkAsync.GetContext方法代码示例

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


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

示例1: TestWeekMenuController

 public TestWeekMenuController()
 {
     _unitOfWork = new UnitOfWork(new ApplicationDbContext());
     _db = _unitOfWork.GetContext();
     _weekMenuService = new MenuForWeekService(_unitOfWork.RepositoryAsync<MenuForWeek>());
     _userManager = new ApplicationUserManager(new UserStore<User>(_unitOfWork.GetContext()));
 }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:7,代码来源:TestWeekMenuController.cs

示例2: WeekMenuController

 public WeekMenuController(IUnitOfWorkAsync unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _db = _unitOfWork.GetContext();
     _weekmenuService = new MenuForWeekService(_unitOfWork.RepositoryAsync<MenuForWeek>());
     _mfdDishPriceService=new MfdDishPriceService(_unitOfWork.RepositoryAsync<MfdDishPriceRelations>());
 }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:7,代码来源:WeekMenuController.cs

示例3: MigrationTest

 public MigrationTest()
 {
     _unitOfWork = new UnitOfWork(new ApplicationDbContext());
     dataContext = _unitOfWork.GetContext();
     IRepositoryAsync<MenuForWeek> menuRepo = _unitOfWork.RepositoryAsync<MenuForWeek>();
     _menuForWeekService = new MenuForWeekService(menuRepo);
     _userManager = new ApplicationUserManager(new UserStore<User>(dataContext));
 }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:8,代码来源:MigrationTest.cs

示例4: EmployeeOrderApiController

 public EmployeeOrderApiController(IUnitOfWorkAsync unitOfWorkAsync)
 {
     _unitOfWork = unitOfWorkAsync;
     _db = unitOfWorkAsync.GetContext();
     _weekMenuService = new MenuForWeekService(_unitOfWork.RepositoryAsync<MenuForWeek>());
     _orderMenuService = new OrderMenuService(_unitOfWork.RepositoryAsync<WeekOrderMenu>());
     _weekPaimentService = new WeekPaimentService(_unitOfWork.RepositoryAsync<WeekPaiment>());
 }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:8,代码来源:EmployeeOrderApiController.cs

示例5: GetDishes

        public static List<Dish> GetDishes(IUnitOfWorkAsync unitOfWork)
        {
            Dish[] dishArray = unitOfWork.GetContext().Dishes.ToArray();
            string[] categories = MapHelper.GetCategoriesStrings(unitOfWork);

            Func<string, IEnumerable<Dish>, int> countDish = (str, list) =>
            {
                int coun = list.Count(el => string.Equals(el.DishType.Category, str));
                return coun;
            };
            Dictionary<string, int> catCount = categories.ToDictionary(cat => cat, count => countDish(count, dishArray));
            Func<List<Dish>> getDishes = () =>
            {
                return catCount.Select(pair => dishArray.Where(d => string.Equals(d.DishType.Category, pair.Key)).ElementAt(Rand.Next(pair.Value))).ToList();
            };

            return getDishes();
        }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:18,代码来源:TestHelper.cs

示例6: GetMapDto

        public static WeekOrderDto GetMapDto(IUnitOfWorkAsync unitOfWork, WeekYearDto wyDto, bool needfact = true)
        {
            ApplicationDbContext context = unitOfWork.GetContext();

            MenuForWeek menuForWeek = unitOfWork.RepositoryAsync<MenuForWeek>().GetWeekMenuByWeekYear(wyDto);

            if (menuForWeek == null) return null;

            List<WeekOrderMenu> weekOrderMenus = unitOfWork.RepositoryAsync<WeekOrderMenu>()
                .OrdersMenuByWeekYear(wyDto).Where(word=>word.User.IsExisting).OrderBy(wo=>wo.User.LastName).ToList();

            return new WeekOrderDto
            {
                WeekYearDto = wyDto,
                SuCanChangeOrder = menuForWeek.SUCanChangeOrder,
                UserWeekOrders =
                    weekOrderMenus.Select(woDto => UserWeekOrderDto.MapDto(context, woDto)).ToList(),
                DayNames = context.GetDayNames(wyDto, true).Result,
                WeekDishPrices = context.GetWeekDishPrices(wyDto).Result,
                SummaryDishQuantities = context.GetFactSumWeekUserCounts(wyDto).Result,
                AllDayNames = context.GetDayNames(wyDto).Result
            };
        }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:23,代码来源:WeekOrderDto.cs

示例7: AccountManagementApiController

 public AccountManagementApiController(IUnitOfWorkAsync unitOfWork)
 {
     _unitOfWork = unitOfWork;
     _userManager = new ApplicationUserManager(new UserStore<User>(_unitOfWork.GetContext()));
     _roleManager = new ApplicationRoleManager(new RoleStore<UserRole>(_unitOfWork.GetContext()));
 }
开发者ID:densem-2013,项目名称:ACSDining,代码行数:6,代码来源:AccountManagementApiController.cs


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