コード例 #1
0
        /// <summary>
        /// Adds the minimum essential AutoPoco services to the specified <see cref="Microsoft.Extensions.DependencyInjection.IServiceCollection"/>
        /// </summary>
        /// <param name="services"> The <see cref="Microsoft.Extensions.DependencyInjection.IServiceCollection"/> to add services to.</param>
        /// <param name="options">Events to fire before or after logging.</param>
        /// <returns></returns>
        public static IServiceCollection AddAutoPoco(this IServiceCollection services, Action <AutoPocoServiceOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            AutoPocoServiceOptions events = new AutoPocoServiceOptions();

            options(events);
            services.AddSingleton(events);

            return(services.AddAutoPoco());
        }
コード例 #2
0
        /// <summary>
        /// Adds the minimum essential AutoPoco services to the specified <see cref="Microsoft.Extensions.DependencyInjection.IServiceCollection"/>
        /// </summary>
        /// <param name="services"> The <see cref="Microsoft.Extensions.DependencyInjection.IServiceCollection"/> to add services to.</param>
        /// <param name="options">Events to fire before or after logging.</param>
        /// <returns></returns>
        public static IServiceCollection AddAutoPoco(this IServiceCollection services, Action <AutoPocoServiceOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            AutoPocoServiceOptions events = new AutoPocoServiceOptions();

            options(events);
            services.AddSingleton(events);


            services.AddAutoPoco();
            services.TryAddTransient <IRequestQueryStringService, RequestQueryStringService>();
            services.AddTransient <IContextEntityConfiguration, VersionedContextEntityConfiguration>();
            return(services);
        }