// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddDbContext <DP_MainContext>(options => options.UseSqlServer(Configuration.GetConnectionString("DefaultDatabase"))); services.AddMvc(options => { options.RespectBrowserAcceptHeader = true; // false by default options.OutputFormatters.Insert(0, new XMLOutputFormatter()); }) .SetCompatibilityVersion(CompatibilityVersion.Version_2_2) .AddXmlDataContractSerializerFormatters(); services.AddOData(); services.AddODataQueryFilter(); services.AddScoped <IPartnersRepository, PartnersRepository>(); services.AddScoped <IPartnersService, PartnersService>(); services.AddScoped <IStmApiClientsRepository, StmApiClientsRepository>(); services.AddScoped <IStmApiClientsService, StmApiClientsService>(); services.AddScoped <IRefMediaTypesRepository, RefMediaTypesRepository>(); services.AddScoped <IRefMediaTypesService, RefMediaTypesService>(); services.AddScoped <IDtBasesRepository, DtBasesRepository>(); services.AddScoped <IDtBasesService, DtBasesService>(); services.AddScoped <IDtTechsRepository, DtTechsRepository>(); services.AddScoped <IDtTechsService, DtTechsService>(); var optionsBuilder = new DbContextOptionsBuilder <DP_MainContext>(); optionsBuilder.UseSqlServer(Configuration.GetConnectionString("DefaultDatabase")); using (var _context = new DP_MainContext(optionsBuilder.Options)) { new AKeys(_context.Stm_Api_Clients.Select(s => s.Api_Key).ToList()); } }
public async Task <IActionResult> GetAsync() { using (var mainContext = new DP_MainContext()) { using (var publishingUnit = new UnitOfWork <RefMediaType>(mainContext)) { var result = await publishingUnit.Repository.Get(); var data = result.Select(type => new { MediaType = type.MediaType, LastUpdate = type.LastUpdated, deleted = type.Deleted }); return(Ok(data)); } } }
public RefMediaTypeRepository(DP_MainContext context) { _context = context; }
public StmApiClientsRepository(DP_MainContext context) { _context = context; }
public StmApiClientsController(DP_MainContext context) { _context = context; }
public DtBaseRepository(DP_MainContext context) { _context = context; }
public AuthClientAPIKeyServices(DP_MainContext context) { _context = context; }
public DtBaseController(DP_MainContext context) { _context = context; }
public TechsController(IDtTechsService dtTechsService, DP_MainContext context) { _dtTechsService = dtTechsService; _context = context; }
public RefPartnersRepository(DP_MainContext context) { _context = context; }
private readonly DP_MainContext _context; // DP_MainContext context public DtTechRepository(DP_MainContext context) { _context = context; }
public RefPartnersController(DP_MainContext context) { _context = context; }
public DtTechController(DP_MainContext context) { _context = context; }
public RefMediaTypeController(DP_MainContext context) { _context = context; }