Example #1
0
        public static TrelonyContext CreateContext(this string sqlServerConnectionString)
        {
            var builder = new DbContextOptionsBuilder <TrelonyContext>();

            builder.UseSqlServer(sqlServerConnectionString);
            var trelonyContext = new TrelonyContext(builder.Options);

            return(trelonyContext);
        }
Example #2
0
 public static async Task <bool> EnsurePresent(this TrelonyContext trelonyContext)
 {
     try
     {
         await trelonyContext.Database.ExecuteSqlCommandAsync("SELECT 1");
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Example #3
0
 public TrelonyUserStore(TrelonyContext context)
 {
     Context = context;
 }
Example #4
0
 public ImportDriver(JsonParser parser, TrelonyContext context, ILogger logger)
 {
     Parser  = parser;
     Context = context;
     Logger  = logger;
 }
Example #5
0
 public CalendarRepository(TrelonyContext context)
 {
     Context = context;
 }
Example #6
0
        public static async Task DropAndRecreate(this TrelonyContext trelonyContext)
        {
            await trelonyContext.Database.EnsureDeletedAsync();

            await trelonyContext.Database.MigrateAsync();
        }
Example #7
0
 public static async Task <bool> ContainsData(this TrelonyContext trelonyContext)
 {
     return(await trelonyContext.Games.AnyAsync() || await trelonyContext.MacroRegions.AnyAsync() ||
            await trelonyContext.SubRegions.AnyAsync() || await trelonyContext.Polygons.AnyAsync());
 }