Exemplo n.º 1
0
        public static IComponentContext UseComposer(this IAppBuilder app, HttpConfiguration configuration = null)
        {
            var composer = ComposerOwinUtil.Setup();

            app.UseComposer(composer, configuration);

            return(composer);
        }
Exemplo n.º 2
0
        public static void UseComposer(this IAppBuilder app, IComponentContext composer, HttpConfiguration configuration = null)
        {
            if (composer == null)
            {
                throw new ArgumentNullException(nameof(composer));
            }

            ComposerOwinUtil.SetResolver(composer, configuration ?? GlobalConfiguration.Configuration);

            app.Use(async(context, next) =>
            {
                context.SetComposer(composer);
                await next.Invoke();
            });
        }