コード例 #1
0
 /// <summary>
 /// Adds the HTTP end point.
 /// </summary>
 /// <param name="theater">The theater.</param>
 /// <param name="endpointAddress">The endpoint address.</param>
 /// <param name="appBuilder">The application builder.</param>
 public static void AddHttpEndPoint(this Theater theater, Uri endpointAddress, IAppBuilder appBuilder)
 {
     var histrioSettings = new TheaterSettings
     {
         Theater = theater,
         EndpointAddress = endpointAddress
     };
     theater.AddEndpoint(endpointAddress);
     appBuilder.UseTheater(histrioSettings);
 }
コード例 #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="TheaterMiddleware" /> class.
        /// </summary>
        /// <param name="theaterSettings">The histrio settings used to configure the middelware</param>
        internal TheaterMiddleware(TheaterSettings theaterSettings)
        {
            var controllerActivator = new TheaterControllerActivator(theaterSettings.Theater);

            MidFunc = next =>
            {
                var app = new AppBuilder();
                app.UseWebApi(GetWebApiConfiguration(controllerActivator));
                app.Run(ctx => next(ctx.Environment));
                return app.Build();
            };
        }
コード例 #3
0
 /// <summary>
 ///     Uses the histrio.
 /// </summary>
 /// <param name="appBuilder">The application builder.</param>
 /// <param name="theaterSettings">The histrio settings.</param>
 /// <returns></returns>
 public static IAppBuilder UseTheater(this IAppBuilder appBuilder, TheaterSettings theaterSettings)
 {
     appBuilder.Use(new TheaterMiddleware(theaterSettings).MidFunc);
     theaterSettings.Theater.AddEndpoint(theaterSettings.EndpointAddress);
     return appBuilder;
 }