I am using Scaffold-DBContext commnand in order to create a model from my database. I implemented
public class CustomCandidateNamingService : CandidateNamingService
{
public override string GenerateCandidateIdentifier(string original)
{
return original.ToUpper();
}
}
because I want to return the property name all uppercase. This works in version 1.1.2 but doesn't work in version 2.0.0-preview1-final.
Do I have to change something?
Thanks.
Let's check this repository. https://github.com/arichika/EFCore2.0-Scaffold-DBContext-CustomCandidateNamingService
You need to change the code.
First, It is necessary to create a new class that inherits IDesignTimeServices.
e.g.
public class MyScaffoldingDesignTimeServices: IDesignTimeServices
{
public void ConfigureDesignTimeServices(IServiceCollection services)
{
services.AddSingleton<ICandidateNamingService,
MyScaffoldingCandidateNamingService>();
}
}
Second, Do this.
e.g.
public class MyScaffoldingCandidateNamingService : CandidateNamingService
{
public override string GenerateCandidateIdentifier(string original)
{
return original.ToUpper();
}
}