示例#1
0
        public static void SeedHostDb(BookingSystemDbContext context)
        {
            context.SuppressAutoSetTenantId = true;

            // Host seed
            new InitialHostDbBuilder(context).Create();

            // Default tenant seed (in host database).
            new DefaultTenantBuilder(context).Create();
            new TenantRoleAndUserBuilder(context, 1).Create();
        }
示例#2
0
        public static BookingSystemDbContext GetInMemoryDbContext()
        {
            var options = new DbContextOptionsBuilder <BookingSystemDbContext>()
                          .UseInMemoryDatabase(databaseName: "Inmemory_db")
                          .ConfigureWarnings(x => x.Ignore(InMemoryEventId.TransactionIgnoredWarning))
                          .Options;
            var seedService = new SeedService();
            var context     = new BookingSystemDbContext(options, seedService);

            lock (_lock)
            {
                if (!context.Users.Any())
                {
                    context.Users.AddRange(seedService.Users.Select(x => x.Value));
                    context.Images.AddRange(seedService.Images.Select(x => x.Value));
                    context.Events.AddRange(seedService.Events.Select(x => x.Value));
                    context.ServiceTypes.AddRange(seedService.ServiceTypes.Select(x => x.Value));
                    context.Services.AddRange(seedService.Services.Select(x => x.Value));
                    context.SaveChanges();
                }
            }

            return(context);
        }
示例#3
0
 public BookingSystemRepository(BookingSystemDbContext context)
 {
     _context = context;
 }
示例#4
0
 public HostRoleAndUserCreator(BookingSystemDbContext context)
 {
     _context = context;
 }
示例#5
0
 public DefaultLanguagesCreator(BookingSystemDbContext context)
 {
     _context = context;
 }
示例#6
0
 public EvenSchedulesController(BookingSystemDbContext context, UserManager <User> userManager, ILogger <EvenSchedulesController> logger)
     : base(context, userManager)
 {
     _logger = logger;
 }
示例#7
0
 public ImageService(BookingSystemDbContext context)
 {
     _ctx = context;
 }
 public InitialHostDbBuilder(BookingSystemDbContext context)
 {
     _context = context;
 }
示例#9
0
 public TenantRoleAndUserBuilder(BookingSystemDbContext context, int tenantId)
 {
     _context  = context;
     _tenantId = tenantId;
 }
 public ServiceEventsController(BookingSystemDbContext context, UserManager <User> userManager, ILogger <ServiceEventsController> logger)
     : base(context, userManager)
 {
     _logger = logger;
 }
示例#11
0
 public ImageSeedService(BookingSystemDbContext context) => _context = context;
示例#12
0
 public DefaultTenantCreator(BookingSystemDbContext context)
 {
     _context = context;
 }
 public BookingManagerService(BookingSystemDbContext context)
 {
     _context = context;
 }
 public DefaultEditionsCreator(BookingSystemDbContext context)
 {
     _context = context;
 }
 public DefaultSettingsCreator(BookingSystemDbContext context)
 {
     _context = context;
 }
示例#16
0
 public EventScheduleService(BookingSystemDbContext context)
 {
     _ctx = context;
 }
示例#17
0
 public BaseController(BookingSystemDbContext context, UserManager <User> userManager)
 {
     _context     = context;
     _userManager = userManager;
 }
示例#18
0
 public DefaultTenantBuilder(BookingSystemDbContext context)
 {
     _context = context;
 }