You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
*This might be a feature request and not support query, hence posting here
Looking for a suggestion about database first, Scaffold-Dbcontext utility in EF Core 6
All our database tables start with fixed prefix that I am keen to remove while entities are generated by scaffold I am looking to
I have previously handled similar requirement using code similar to the one below, with EF Core 3.0
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.EntityFrameworkCore.Scaffolding.Internal;
using Microsoft.Extensions.DependencyInjection;
using System.Collections.Generic;
namespace ProjectName.Entity.Models
{
public class ProjectNameEntityTypeGenerator : CSharpUtilities
{
public override string Uniquifier(string proposedIdentifier, ICollection<string> existingIdentifiers)
{
var finalIdentifier = base.Uniquifier(proposedIdentifier, existingIdentifiers);
//Prefix entity names with underscore
if (finalIdentifier.ToLower().StartsWith("tbl"))
{
finalIdentifier = finalIdentifier.Replace("Tbl", string.Empty);
}
return finalIdentifier;
}
}
public class CustomEFDesignTimeServices : IDesignTimeServices
{
//Used for scaffolding database to code
public void ConfigureDesignTimeServices(IServiceCollection serviceCollection)
{
serviceCollection.AddSingleton<ICSharpUtilities, ProjectNameEntityTypeGenerator>();
}
}
}
However, EF Core has completely changed the namespace/class structure and CSharpUtilities class is no longer available.
What is the alternate option available in EF Core 6 to control naming of the entities as part of entity generation? we certainly don't want to manually rename the entity names after generation as it's not very productive and also because we want to add more options over naming of auto generated entities.
Include provider and version information
EF Core version: 6
Database provider: (e.g. Oracle.EntityFrameworkCore)
Target framework: (e.g. .NET 6.0)
Operating system:
IDE: (e.g. Visual Studio 2022)
The text was updated successfully, but these errors were encountered:
*This might be a feature request and not support query, hence posting here
Looking for a suggestion about database first, Scaffold-Dbcontext utility in EF Core 6
All our database tables start with fixed prefix that I am keen to remove while entities are generated by scaffold I am looking to
I have previously handled similar requirement using code similar to the one below, with EF Core 3.0
However, EF Core has completely changed the namespace/class structure and CSharpUtilities class is no longer available.
What is the alternate option available in EF Core 6 to control naming of the entities as part of entity generation? we certainly don't want to manually rename the entity names after generation as it's not very productive and also because we want to add more options over naming of auto generated entities.
Include provider and version information
EF Core version: 6
Database provider: (e.g. Oracle.EntityFrameworkCore)
Target framework: (e.g. .NET 6.0)
Operating system:
IDE: (e.g. Visual Studio 2022)
The text was updated successfully, but these errors were encountered: