Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="TMiddelware"></typeparam>
        /// <param name="builder"></param>
        /// <param name="args"></param>
        /// <returns></returns>
        public static IControlLoopBuilder Use <TMiddelware>(this IControlLoopBuilder builder, params object[] args) where TMiddelware : IControlLoopMiddleware
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Use(typeof(TMiddelware), args);
            return(builder);
        }
Example #2
0
        public static IControlLoopBuilder Invoke(this IControlLoopBuilder builder, Func <IDroneServerContext, ControlPoint, Task> middleware)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }
            if (middleware is null)
            {
                throw new ArgumentNullException(nameof(middleware));
            }

            builder.Use <InlineMiddleware>(builder.ApplicationServices.GetRequiredService <IDroneServerContext>(), middleware);
            return(builder);
        }