Esempio n. 1
0
        /// <summary>
        /// Adds configured <see cref="NetWorker"/>
        /// and its configuration <see cref="NetWorkerConfig"/>
        /// to the service collection
        /// </summary>
        public static IServiceCollection AddNetWorker(
            this IServiceCollection services,
            Action <NetWorkerConfig> configOptions)
        {
            // configure the config
            var config = new NetWorkerConfig();

            configOptions?.Invoke(config);

            return(services
                   // add config
                   .AddSingleton(config)

                   // add NetWorker
                   .AddSingleton <NetWorker>());
        }
Esempio n. 2
0
 public NetWorker(NetWorkerConfig config)
 {
     _config = config;
 }