Ejemplo n.º 1
0
        public AppHost(IServiceProvider services) :
            base(services.GetRequiredService <IHostingEnvironment> ().ApplicationName, typeof(AppHost).Assembly)
        {
            OrderOfOperations.Log = Path.Combine(services.GetRequiredService <IHostingEnvironment>().ContentRootPath, "orderofoperations.txt");
            if (File.Exists(OrderOfOperations.Log))
            {
                File.WriteAllText(OrderOfOperations.Log, "");
            }

            this.AppSettings = new NetCoreAppSettings(services.GetRequiredService <IConfiguration> ());
            OrderOfOperations.Add(typeof(AppHost), "() // Constructor");

            this.RawHttpHandlers.Add((req) => {
                OrderOfOperations.Add(typeof(AppHost), "RawHttpHandlers[]");
                return(null);
            });

            this.CatchAllHandlers.Add((httpMethod, pathInfo, filePath) => {
                OrderOfOperations.Add(typeof(AppHost), "CatchAllHandlers[]");
                return(null);
            });

            this.PreRequestFilters.Add((req, res) => {
                OrderOfOperations.Add(typeof(AppHost), "PreRequestFilters");
            });

            this.GlobalRequestFilters.Add((req, res, dto) => {
                OrderOfOperations.Add(typeof(AppHost), "GlobalRequestFilters");
            });
        }
Ejemplo n.º 2
0
 public override object OnAfterExecute(IRequest request, object response)
 {
     // Called just after any Action is executed.
     // You can modify the response returned here as well
     // return base.OnAfterExecute(request, response);
     OrderOfOperations.Add(typeof(CustomServiceRunner <TRequest>), "OnAfterExecute()");
     return(OrderOfOperations.GetOperations());
 }
Ejemplo n.º 3
0
 public object Any(FreshRequest request)
 {
     OrderOfOperations.Add(typeof(FreshService), "Any(FreshRequest) --> START");
     // force some DI calls
     AttemptResolve(() => { var x = base.Db; });
     AttemptResolve(() => { var x = base.Cache; });
     AttemptResolve(() => { var x = base.IsAuthenticated; });
     AttemptResolve(() => { var x = base.VirtualFiles; });
     OrderOfOperations.Add(typeof(FreshService), "Any(FreshRequest) --> END");
     return(OrderOfOperations.GetOperations());
 }
Ejemplo n.º 4
0
        public override void Configure(Container container)
        {
            SetConfig(new HostConfig());
            OrderOfOperations.Add(typeof(AppHost), "Configure()");

            base.RequestBinders.Add(typeof(FallbackRequest), req => {
                OrderOfOperations.Add(typeof(AppHost), "RequestBinders");
                return(req.Dto);
            });

            base.RequestBinders.Add(typeof(ClearRequest), req => {
                OrderOfOperations.Add(typeof(AppHost), "RequestBinders");
                return(req.Dto);
            });

            Plugins.Add(new AddedPlugin());
            LoadPlugin(new LoadedPlugin());

            OrderOfOperations.Add(typeof(AppHost), "Configure() // done configuring");
        }
Ejemplo n.º 5
0
 public void Configure(IAppHost appHost)
 {
     OrderOfOperations.Add(typeof(LoadedPlugin), "Configure(appHost) // IPreInitPlugin");
 }
Ejemplo n.º 6
0
 public override Exception ResolveResponseException(Exception ex)
 {
     OrderOfOperations.Add(typeof(AppHost), "ResolveResponseException"); return(base.ResolveResponseException(ex));
 }
Ejemplo n.º 7
0
 public void AfterPluginsLoaded(IAppHost appHost)
 {
     OrderOfOperations.Add(typeof(LoadedPlugin), "AfterPluginsLoaded(appHost) // IPostInitPlugin");
 }
Ejemplo n.º 8
0
 public override string ResolveLocalizedString(string text, IRequest request)
 {
     OrderOfOperations.Add(typeof(AppHost), "ResolveLocalizedString"); return(base.ResolveLocalizedString(text, request));
 }
Ejemplo n.º 9
0
 public FreshRequest()
 {
     OrderOfOperations.Add(typeof(FreshRequest), "() // Constructor");
 }
Ejemplo n.º 10
0
 public object Any(FallbackRequest request)
 {
     OrderOfOperations.Add(typeof(FallbackService), "Any(FallbackRequest)");
     return(OrderOfOperations.GetOperations());
 }
Ejemplo n.º 11
0
 public ClearService()
 {
     OrderOfOperations.Add(typeof(ClearService), "() // Constructor");
 }
Ejemplo n.º 12
0
 public override T TryResolve <T> ()
 {
     OrderOfOperations.Add(typeof(AppHost), "TryResolve<T> --> typeof({0})".FormatWith(typeof(T))); return(base.TryResolve <T>());
 }
Ejemplo n.º 13
0
 public override bool UseHttps(IRequest httpReq)
 {
     OrderOfOperations.Add(typeof(AppHost), "UseHttps"); return(base.UseHttps(httpReq));
 }
Ejemplo n.º 14
0
 public override ServiceStackHost Start(string urlBase)
 {
     OrderOfOperations.Add(typeof(AppHost), "Start"); return(base.Start(urlBase));
 }
Ejemplo n.º 15
0
 public override IRequest TryGetCurrentRequest()
 {
     OrderOfOperations.Add(typeof(AppHost), "TryGetCurrentRequest()");
     return(base.TryGetCurrentRequest());
 }
Ejemplo n.º 16
0
 public override bool ShouldCompressFile(IVirtualFile file)
 {
     OrderOfOperations.Add(typeof(AppHost), "ShouldCompressFile"); return(base.ShouldCompressFile(file));
 }
Ejemplo n.º 17
0
 public override void SetConfig(HostConfig config)
 {
     OrderOfOperations.Add(typeof(AppHost), "SetConfig"); base.SetConfig(config);
 }
Ejemplo n.º 18
0
 public override IHttpHandler ReturnRequestInfoHandler(IHttpRequest httpReq)
 {
     OrderOfOperations.Add(typeof(AppHost), "ReturnRequestInfoHandler"); return(base.ReturnRequestInfoHandler(httpReq));
 }
Ejemplo n.º 19
0
 public void Register(IAppHost appHost)
 {
     OrderOfOperations.Add(typeof(LoadedPlugin), "Init(appHost) // IPlugin");
 }
Ejemplo n.º 20
0
 protected override ServiceController CreateServiceController(params Assembly[] assembliesWithServices)
 {
     OrderOfOperations.Add(typeof(AppHost), "CreateServiceController"); return(base.CreateServiceController(assembliesWithServices));
 }
Ejemplo n.º 21
0
 public FallbackService()
 {
     OrderOfOperations.Add(typeof(FallbackService), "() // Constructor");
 }
Ejemplo n.º 22
0
 protected override void Dispose(bool disposing)
 {
     OrderOfOperations.Add(typeof(AppHost), "Dispose()");
     base.Dispose(disposing);
 }
Ejemplo n.º 23
0
 public FallbackRequest()
 {
     OrderOfOperations.Add(typeof(FallbackRequest), "() // Constructor");
 }
Ejemplo n.º 24
0
 public override string ResolveAbsoluteUrl(string overridePath, IRequest httpReq)
 {
     OrderOfOperations.Add(typeof(AppHost), "ResolveAbsoluteUrl"); return(base.ResolveAbsoluteUrl(overridePath, httpReq));
 }
Ejemplo n.º 25
0
 public FreshService()
 {
     OrderOfOperations.Add(typeof(FreshService), "() // Constructor");
 }
Ejemplo n.º 26
0
 public override string ResolvePathInfo(IRequest request, string originalPathInfo)
 {
     OrderOfOperations.Add(typeof(AppHost), "ResolvePathInfo({0}, {1})".FormatWith(request.Dto?.GetType(), originalPathInfo)); return(base.ResolvePathInfo(request, originalPathInfo));
 }
Ejemplo n.º 27
0
 public ClearRequest()
 {
     OrderOfOperations.Add(typeof(ClearRequest), "() // Constructor");
 }
Ejemplo n.º 28
0
 public LoadedPlugin()
 {
     OrderOfOperations.Add(typeof(LoadedPlugin), "() // Constructor");
 }
Ejemplo n.º 29
0
 public override void OnBeforeExecute(IRequest requestContext, TRequest request)
 {
     // Called just before any Action is executed
     OrderOfOperations.Add(typeof(CustomServiceRunner <TRequest>), "OnBeforeExecute()");
     base.OnBeforeExecute(requestContext, request);
 }
Ejemplo n.º 30
0
 public override string ResolvePhysicalPath(string overridePath, IRequest httpReq)
 {
     OrderOfOperations.Add(typeof(AppHost), "ResolvePhysicalPath('{0}', req)".FormatWith(overridePath)); return(base.ResolvePhysicalPath(overridePath, httpReq));
 }