using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata.Conventions.Infrastructure; using EFCore.NamingConventions.Internal; using JetBrains.Annotations; // ReSharper disable once CheckNamespace namespace Microsoft.Extensions.DependencyInjection; /// /// Extension methods for . /// public static class NamingConventionsServiceCollectionExtensions { /// /// /// Adds the services required for applying naming conventions in Entity Framework Core. /// You use this method when using dependency injection in your application, such as with ASP.NET. /// For more information on setting up dependency injection, see http://go.microsoft.com/fwlink/?LinkId=526890. /// /// /// You only need to use this functionality when you want Entity Framework to resolve the services it uses /// from an external dependency injection container. If you are not using an external /// dependency injection container, Entity Framework will take care of creating the services it requires. /// /// /// The to add services to. /// /// The same service collection so that multiple calls can be chained. /// public static IServiceCollection AddEntityFrameworkNamingConventions( [NotNull] this IServiceCollection serviceCollection) { Check.NotNull(serviceCollection, nameof(serviceCollection)); new EntityFrameworkServicesBuilder(serviceCollection) .TryAdd(); return serviceCollection; } }