Describe the bug
Imports are wrongly generated (e.g. using masters = .masters) in context file when EnableSchemaFolders = true in options but either namespace is not provided or its same for context and model.
Expected behavior
It should generate namespace as
using <schema> = <modelNamespace>.<schema>
or
using <modelNamespace>.<schema>
Make My Life Easier
This seems to be happening due to this condition , which is not assigning value to _modelNamespace when both namespace are same
File: HbsCSharpDbContextGenerator.cs
Method: WriteCode(..)
if (!string.IsNullOrEmpty(modelNamespace) && string.CompareOrdinal(contextNamespace, modelNamespace) != 0)
_modelNamespace = modelNamespace;
Describe the bug Imports are wrongly generated (e.g.
using masters = .masters
) in context file when EnableSchemaFolders = true in options but either namespace is not provided or its same for context and model.Expected behavior It should generate namespace as
using <schema> = <modelNamespace>.<schema>
orusing <modelNamespace>.<schema>
To Reproduce Using PostgreSQL with
Scaffold-DbContext Name=<connection string> Npgsql.EntityFrameworkCore.PostgreSQL -Namespace SomeAPI.DbModels -ContextNamespace SomeAPI.DbModels -o DbModels
or
Scaffold-DbContext Name=<connection string> Npgsql.EntityFrameworkCore.PostgreSQL -o DbModels
Make My Life Easier This seems to be happening due to this condition , which is not assigning value to _modelNamespace when both namespace are same File: HbsCSharpDbContextGenerator.cs Method: WriteCode(..)