Beispiel #1
0
        public static IODataCoreBuilder AddOData([NotNull] this IServiceCollection services,
                                                 Action <IServiceCollection> configSerivces)
        {
            IODataCoreBuilder builder = services.AddOData();

            configSerivces(services); // for customers override services
            return(builder);
        }
Beispiel #2
0
        /// <summary>
        /// Adds essential OData services to the specified <see cref="IServiceCollection" />.
        /// </summary>
        /// <param name="services">The <see cref="IServiceCollection" /> to add services to.</param>
        /// <param name="setupAction">An <see cref="Action{MvcOptions}"/> to configure the provided <see cref="ODataOptions"/>.</param>
        /// <returns>An <see cref="IODataCoreBuilder"/> that can be used to further configure the MVC services.</returns>
        public static IODataCoreBuilder AddOData([NotNull] this IServiceCollection services,
                                                 Action <ODataOptions> setupAction)
        {
            if (services == null)
            {
                throw new ArgumentNullException(nameof(services));
            }

            if (setupAction == null)
            {
                throw new ArgumentNullException(nameof(setupAction));
            }

            IODataCoreBuilder builder = services.AddOData();

            builder.Services.Configure(setupAction);
            return(builder);
        }