本文整理汇总了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()));
}
示例2: WeekMenuController
public WeekMenuController(IUnitOfWorkAsync unitOfWork)
{
_unitOfWork = unitOfWork;
_db = _unitOfWork.GetContext();
_weekmenuService = new MenuForWeekService(_unitOfWork.RepositoryAsync<MenuForWeek>());
_mfdDishPriceService=new MfdDishPriceService(_unitOfWork.RepositoryAsync<MfdDishPriceRelations>());
}
示例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));
}
示例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>());
}
示例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();
}
示例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
};
}
示例7: AccountManagementApiController
public AccountManagementApiController(IUnitOfWorkAsync unitOfWork)
{
_unitOfWork = unitOfWork;
_userManager = new ApplicationUserManager(new UserStore<User>(_unitOfWork.GetContext()));
_roleManager = new ApplicationRoleManager(new RoleStore<UserRole>(_unitOfWork.GetContext()));
}