/// <summary> /// Initializes a new instance of the <see cref="T:IceFactory.Repository.GenericRepository`1" /> class. /// </summary> /// <param name="context">Context.</param> protected Repository(IceFactoryContext context) { Context = context; _dbSet = context.Set <TEntity>(); }
public vwProductRepository(IceFactoryContext context) : base(context) { }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IceFactoryContext iceFactoryContext) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } // // Forward http headers use for run this system under reverse proxy // such as IISARR or NGINX. app.UseForwardedHeaders(); app.UseExceptionHandler(appBuilder => { appBuilder.Use(async(context, next) => { var error = context.Features[typeof(IExceptionHandlerFeature)] as IExceptionHandlerFeature; //when authorization has failed, should return a json message to client if (error?.Error is SecurityTokenExpiredException) { context.Response.StatusCode = 401; context.Response.ContentType = "application/json"; await context.Response.WriteAsync(JsonConvert.SerializeObject(new { State = 401, Message = "token expired" })); } //when other error, return a error message json to client else if (error?.Error != null) { context.Response.StatusCode = 500; context.Response.ContentType = "application/json"; await context.Response.WriteAsync(JsonConvert.SerializeObject(new { State = 500, error.Error.Message })); } //when no error, do next. else { await next(); } }); }); // // Shows UseCors with named policy. app.UseCors("CorsPolicy"); app.UseAuthentication(); app.UseHttpsRedirection(); app.UseMvc(); // // Initial data to database when create new database for first time. IceFactoryInitializer.InitializeAsync(iceFactoryContext).Wait(); }
public UnitRepository(IceFactoryContext context) : base(context) { }
public ProductStockRepository(IceFactoryContext context) : base(context) { }