entity framework core - Scaffold-DbContext returns System.ArgumentNullException: Parameter name: proposedIdentifier in EFCore 2.0 when trying to pluralize -
when run command scaffold-dbcontext "server=localhost;database=mydatabase;integrated security=true" microsoft.entityframeworkcore.sqlserver
i error:
system.argumentnullexception: value cannot null. parameter name: proposedidentifier @ microsoft.entityframeworkcore.utilities.check.notempty(string value, string parametername) @ microsoft.entityframeworkcore.scaffolding.internal.csharputilities.uniquifier(string proposedidentifier, icollection`1 existingidentifiers) @ microsoft.entityframeworkcore.scaffolding.internal.csharputilities.generatecsharpidentifier(string identifier, icollection`1 existingidentifiers, func`2 singularizepluralizer, func`3 uniquifier) @ microsoft.entityframeworkcore.scaffolding.internal.csharputilities.generatecsharpidentifier(string identifier, icollection`1 existingidentifiers, func`2 singularizepluralizer) @ microsoft.entityframeworkcore.scaffolding.internal.csharpnamer`1.getname(t item) @ microsoft.entityframeworkcore.scaffolding.internal.csharpuniquenamer`1.getname(t item) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.getentitytypename(databasetable table) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.visittable(modelbuilder modelbuilder, databasetable table) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.visittables(modelbuilder modelbuilder, icollection`1 tables) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.visitdatabasemodel(modelbuilder modelbuilder, databasemodel databasemodel) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.createfromdatabasemodel(databasemodel databasemodel, boolean usedatabasenames) @ microsoft.entityframeworkcore.scaffolding.internal.relationalscaffoldingmodelfactory.create(string connectionstring, ienumerable`1 tables, ienumerable`1 schemas, boolean usedatabasenames) @ microsoft.entityframeworkcore.scaffolding.internal.modelscaffolder.generate(string connectionstring, ienumerable`1 tables, ienumerable`1 schemas, string projectpath, string outputpath, string rootnamespace, string contextname, boolean usedataannotations, boolean overwritefiles, boolean usedatabasenames) @ microsoft.entityframeworkcore.design.internal.databaseoperations.scaffoldcontext(string provider, string connectionstring, string outputdir, string dbcontextclassname, ienumerable`1 schemas, ienumerable`1 tables, boolean usedataannotations, boolean overwritefiles, boolean usedatabasenames) @ microsoft.entityframeworkcore.design.operationexecutor.scaffoldcontextimpl(string provider, string connectionstring, string outputdir, string dbcontextclassname, ienumerable`1 schemafilters, ienumerable`1 tablefilters, boolean usedataannotations, boolean overwritefiles, boolean usedatabasenames) @ microsoft.entityframeworkcore.design.operationexecutor.scaffoldcontext.<>c__displayclass0_1.<.ctor>b__0() @ microsoft.entityframeworkcore.design.operationexecutor.operationbase.<>c__displayclass3_0`1.<execute>b__0() @ microsoft.entityframeworkcore.design.operationexecutor.operationbase.execute(action action) value cannot null. parameter name: proposedidentifier.
in startup project have:
public class custompluralizerdesigntimeservices : idesigntimeservices { public void configuredesigntimeservices(iservicecollection services) { services.addsingleton<ipluralizer, humanizertoipluralizeradapter>(); } } public class humanizertoipluralizeradapter : ipluralizer { public string pluralize(string name) => name.pluralize(); public string singularize(string name) => name.singularize(); }
when remove code, scaffolding works.
dependencies:
dataaccess project (.net standard 2.0)
- microsoft.entityframeworkcore.sqlserver 2.0
- microsoft.entityframeworkcore.tools
- microsoft.visualstudio.web.codegeneration.design
startup project (.net core 2.0)
- microsoft.aspnetcore.all
looks bug in ipluralizer
implementation. ensure it's not returning null or empty string values.
Comments
Post a Comment