コード例 #1
0
ファイル: Builder.cs プロジェクト: tylike/Excess
        public static void UseExcess(this IAppBuilder app,
                                     __Scope scope,
                                     Action <ConcurrentAppSettings> initializeSettings = null,
                                     Action <IDistributedApp> initializeApp            = null,
                                     IEnumerable <Type> functional        = null,
                                     IEnumerable <FilterFunction> filters = null)
        {
            var settings = new ConcurrentAppSettings();

            initializeSettings?.Invoke(settings);

            var server = new DistributedApp(new ThreadedConcurrentApp(
                                                types: null,
                                                threadCount: settings.Threads,
                                                blockUntilNextEvent: settings.BlockUntilNextEvent));

            initializeApp?.Invoke(server);

            app.Use <ExcessOwinMiddleware>(server, scope, functional, filters);
            server.Start();
        }
コード例 #2
0
ファイル: Builder.cs プロジェクト: tylike/Excess
        public static void UseExcess(this IAppBuilder builder,
                                     IEnumerable <Assembly> assemblies,
                                     ConcurrentAppSettings settings = null)
        {
            var scope = Application.Load(assemblies);

            UseExcess(builder,
                      scope,
                      initializeSettings: _settings =>
            {
                if (settings != null)
                {
                    _settings.From(settings);
                }
            },
                      initializeApp: app => Loader.FromAssemblies(app, assemblies, null),
                      functional: assemblies
                      .SelectMany(assembly => assembly
                                  .GetTypes()
                                  .Where(type => type.Name == "Functions")));
        }
コード例 #3
0
ファイル: Builder.cs プロジェクト: tylike/Excess
 public static void UseExcess <T>(this IAppBuilder builder, ConcurrentAppSettings settings = null)
 {
     UseExcess(builder, new[] { typeof(T).Assembly });
 }
コード例 #4
0
ファイル: Builder.cs プロジェクト: tylike/Excess
 public void From(ConcurrentAppSettings settings)
 {
     Threads             = settings.Threads;
     BlockUntilNextEvent = settings.BlockUntilNextEvent;
 }