Exemplo n.º 1
0
 public SecUserRepository(HCPatientContext context) : base(context)
 {
     this._context = context;
 }
Exemplo n.º 2
0
 public TokenRepository(HCPatientContext context)
 {
     this._context = context;
 }
Exemplo n.º 3
0
        // 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, HCPatientContext context)//,
        {
            var jwtAppSettingOptions      = Configuration.GetSection(nameof(JwtIssuerOptions));
            var tokenValidationParameters = new TokenValidationParameters
            {
                ValidateIssuer = true,
                ValidIssuer    = jwtAppSettingOptions[nameof(JwtIssuerOptions.Issuer)],

                ValidateAudience = true,
                ValidAudience    = jwtAppSettingOptions[nameof(JwtIssuerOptions.Audience)],

                ValidateIssuerSigningKey = true,
                IssuerSigningKey         = _signingKey,

                RequireExpirationTime = true,
                ValidateLifetime      = true,

                ClockSkew = TimeSpan.Zero
            };

            app.UseElmahIo("6e46539834624195b66edb223f370836", new Guid("d6251932-8823-4afe-b0ba-0ef3fac938fb"));
            app.UseJwtBearerAuthentication(new JwtBearerOptions
            {
                AutomaticAuthenticate     = true,
                AutomaticChallenge        = true,
                TokenValidationParameters = tokenValidationParameters
            });

            app.UseCors(DefaultCorsPolicyName); //Enable CORS!
            //loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            //loggerFactory.AddDebug();

            //app.UseForwardedHeaders(new ForwardedHeadersOptions
            //{
            //    ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
            //});


            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            app.UseExceptionHandler(
                builder =>
            {
                builder.Run(
                    async dbcontext =>
                {
                    dbcontext.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
                    dbcontext.Response.Headers.Add("Access-Control-Allow-Origin", "*");

                    var error = dbcontext.Features.Get <IExceptionHandlerFeature>();
                    if (error != null)
                    {
                        // context.Response.AddApplicationError(error.Error.Message);
                        await dbcontext.Response.WriteAsync(error.Error.Message).ConfigureAwait(false);
                    }
                });
            });

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "defaultWithArea",
                    template: "{area}/{controller=Home}/{action=Index}/{id?}");

                routes.MapRoute(
                    name: "default",
                    template: "{controller=Account}/{action=Index}/{id?}");
            });
            //app.UseJsonApi();
            // Enable middleware to serve generated Swagger as a JSON endpoint.
            app.UseSwagger();


            // Enable middleware to serve swagger-ui (HTML, JS, CSS etc.), specifying the Swagger JSON endpoint.
            app.UseSwaggerUI(c =>
            {
                c.SwaggerEndpoint("v1/swagger.json", "My API V1");
            });

            context.Database.EnsureCreated();
            //if (context.PASCore_Users.Any() == false)
            //{
            //    //context.PASCore_UserRoles.Add(new PASCore_UserRoles
            //    //{
            //    //    EntityId = Guid.NewGuid(),
            //    //    FirstName="test"
            //    //});
            //    context.SaveChanges();
            //}
            // ...
            app.UseJsonApi();
            //ConfigureAuth(app);

            loggerFactory.AddNLog();


            //add NLog.Web
            app.AddNLogWeb();



            var configDir = "C:\\Logs";

            if (configDir != string.Empty)
            {
                var logEventInfo = LogEventInfo.CreateNullEvent();


                foreach (FileTarget target in LogManager.Configuration.AllTargets.Where(t => t is FileTarget))
                {
                    var filename = target.FileName.Render(logEventInfo).Replace("'", "");
                    target.FileName = Path.Combine(configDir, filename);
                }

                LogManager.ReconfigExistingLoggers();
            }
            //LogManager.Configuration = new LoggingConfiguration();

            organization = context.Organization.Where(p => p.Id == organizationID).FirstOrDefault();
            LogManager.Configuration.Variables["connectionString"] = Configuration.GetConnectionString("HCPatient");

            LogManager.Configuration.Variables["configDir"] = "C:\\Logs";
            LogManager.ConfigurationReloaded += updateConfig;
            app.UseMvc();
        }
Exemplo n.º 4
0
 public MasterDataRepository(HCPatientContext context)
 {
     this._context = context;
 }
Exemplo n.º 5
0
 public PatientCommonRepository(HCPatientContext context)
 {
     this._context = context;
 }
Exemplo n.º 6
0
 public EntityRepository(HCPatientContext context) : base(context)
 {
     this._context = context;
 }
Exemplo n.º 7
0
 public HullTypeRepository(HCPatientContext context) : base(context)
 {
     this._context = context;
 }
Exemplo n.º 8
0
 public Repository(HCPatientContext context)
 {
     this.context = context;
     entities     = context.Set <T>();
 }