/// <summary>Default constructor for configuring the worker classes for this controller.</summary> /// <param name="trinity">The instance required for undertaking data management/verification purposes on the business ontology.</param> public CredentialsController(DbContextTrinity trinity) { repo = new ModelRepository <Credential>(trinity.DefaultModel); shaper = new ModelFormatter <Credential>(trinity.DefaultModel.Uri.AbsoluteUri); checker = new ModelValidator <Credential>(trinity.DefaultModel); crypto = new CredentialHasher(); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseHsts(); } app.UseCors(MyAllowSpecificOrigins); app.UseHttpsRedirection(); app.UseMvc(routeBuilder => { // Get the OData model var odataModel = DbContextTrinity.GetEdmModel(); routeBuilder.EnableDependencyInjection(); routeBuilder.Select().Filter().OrderBy().Expand().Count().MaxTop(10); routeBuilder.MapODataServiceRoute( "odata", "odata", odataModel, new DefaultODataBatchHandler() ); }); }
public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } app.UseHttpsRedirection(); app.UseRouting(); app.UseCors("CorsConfig"); app.UseAuthorization(); app.UseEndpoints(endpoints => { var odataModel = DbContextTrinity.GetEdmModel(); endpoints.MapControllers(); endpoints.EnableDependencyInjection(); endpoints.Select().Filter().OrderBy().Expand().Count().MaxTop(10); endpoints.MapODataRoute("odata", "odata", odataModel, new DefaultODataBatchHandler()); }); }
public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy("CorsConfig", builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod(); }); }); services.AddControllers(); services.AddScoped <DbContextTrinity>(); DbContextTrinity trinity = new DbContextTrinity(); trinity.Initialise(); services.AddMvc().AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);; services.AddOData(); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddCors(options => { options.AddPolicy(MyAllowSpecificOrigins, builder => { builder.AllowAnyOrigin() .AllowAnyHeader() .AllowAnyMethod() .AllowCredentials(); }); }); services.AddMvcCore(action => action.EnableEndpointRouting = false); services.AddMvc() .SetCompatibilityVersion(CompatibilityVersion.Version_2_1) .AddJsonOptions(options => options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore); services.AddScoped <DbContextTrinity>(); services.AddOData(); DbContextTrinity trinity = new DbContextTrinity(); trinity.Initialise(); }
public ActivitiesController(DbContextTrinity trinity) { repo = new ModelRepository <Activity>(trinity.DefaultModel); }
public CyclingsController(DbContextTrinity trinity) { repo = new ModelRepository <Cycling>(trinity.DefaultModel); shaper = new ModelFormatter <Cycling>(trinity.DefaultModel.Uri.AbsoluteUri); checker = new ModelValidator <Cycling>(trinity.DefaultModel); }