Closed BBSquared closed 3 years ago
Hi @BBSquared, Handlebars Scaffolding supports the concept of Schema Folders.
When you enable Schema Folders, entities are placed in the schema namespace, which is the same as the folder name (following .NET coding conventions). When you use the schema qualified entities in your code, you can alias the schema namespace, for example, as dbo.Category
, as shown here in NorthwindSlimContext
.
Would this possibly meet your needs? If not, you have the option of extendingHbsCSharpEntityTypeGenerator
to override GenerateClass
. You can find instruction here.
Regarding your request to pass IEntityType
instead of IEntityTypeName
, an overload to AddHandlebarsTransformers
could be added, but this would require a change to IEntityTypeTransformationService
, as well as a number of other places.
Please re-open if there are further questions or concerns.
There's no easy way to add schema in to the object names as far as I can tell. Would it be possible to make the entityNameTransformer include a more complex object that includes the database schema? example:
// Add optional Handlebars transformers with Schema services.AddHandlebarsTransformers( entityNameTransformer: o=> o.Schema + "_" + o.Name
)
*edit: instead of passing IEntityType.Name, just pass IEntityType ?