-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Bug
Copy link
Description
Hi,
We've requierment to add using statement :
using IBM.EntityFrameworkCore
Above statement has to be added while generating the Context class via scaffolding. Till .NET 6 we implemented CSharpDbContextGenerator and added in our service, but from .NET7 we see it is part of .tt file which we are not much familior..
how can we achieve the same result now ?
public override string WriteCode(
IModel model,
string contextName,
string connectionString,
string? contextNamespace,
string? modelNamespace,
bool useDataAnnotations,
bool useNullableReferenceTypes,
bool suppressConnectionStringWarning,
bool suppressOnConfiguring)
{
Check.NotNull(model, nameof(model));
#pragma warning disable EF1001 // Internal EF Core API usage.
_sb = new IndentedStringBuilder();
_sb.AppendLine("using IBM.EntityFrameworkCore;");
//_sb.AppendLine("using IBM.EntityFrameworkCore.Storage.Internal;");
return _sb.AppendLines(base.WriteCode(model, contextName, connectionString, contextNamespace, modelNamespace, useDataAnnotations, useNullableReferenceTypes, suppressConnectionStringWarning, suppressOnConfiguring)).ToString();
#pragma warning restore EF1001 // Internal EF Core API usage.
}