Arturo Hernandez
Arturo Hernandez

Reputation: 2869

Why do I get an error while resolving the Pluralization Service in EF6?

I have the following code in my Context class. Straight from this MSDN post .

    private string GetTableName(Type type)
    {
        var pluralizationService = DbConfiguration.DependencyResolver.GetService<IPluralizationService>();
        var result = pluralizationService.Pluralize(type.Name);
        result = Regex.Replace(result, ".[A-Z]", m => m.Value[0] + "_" + m.Value[1]);
        return result.ToUpper();
    }

The error I get is The non-generic method 'System.Data.Entity.Infrastructure.DependencyResolution.IDbDependencyResolver.GetService(System.Type, object)' cannot be used with type arguments I am thinking either I am missing a using clause. Or there is a problem with entity framework 6.0.1. I can't find what library do I need to include, other than System.Data.Entity and System.Data.Entity.Infrastructure.Pluralization.

Upvotes: 1

Views: 660

Answers (1)

Ben
Ben

Reputation: 2484

try to add using System.Data.Entity.Infrastructure.DependencyResolution;

Upvotes: 3

Related Questions