Comments (10)
Digging around I didn't see any way to prefix the schema
Have you seen the Schema Folders feature?
services.AddHandlebarsScaffolding(options =>
{
// Put Models into folders by DB Schema
options.EnableSchemaFolders = true;
});
Does this meet your need?
from entityframeworkcore.scaffolding.handlebars.
Ah I have seen that and it's handy but doesn't quite fit the bill. I was explicitly asked to prefix the class name with the schema by the lead developer. It would also help with the fact we have a bunch of duplicate table names across schemas, so being able to prefix might fix some of the Table, Table1, Table2, naming issues we run into.
from entityframeworkcore.scaffolding.handlebars.
Have a look at the sample app and you'll see that DB schema names are represented as folders, which adds the schema to the namespace for each class within that namespace. This solves the problem of duplicate table names across schemas, because they are disambiguated by namespace, which is how it's done in C#.
from entityframeworkcore.scaffolding.handlebars.
Ah I probably just muddied the waters mentioning duplicate tables. I had wanted to use schema folders, but it isn't up to me. My team lead is having to compromise between moving to modern .Net standards while keeping to some of the company's older, custom conventions. In this case, he opted to prefix schema names to entities to keep with the custom conventions.
I could go into more detail but in the end we were hoping for more control over naming entities. That said if that's not something you think would be good to allow no worries. I can make my own fork for this specific project.
from entityframeworkcore.scaffolding.handlebars.
@CDMayberry EF Core Power Tools allows you to do custom naming
from entityframeworkcore.scaffolding.handlebars.
@CDMayberry EF Core Power Tools allows you to do custom naming
Ah I do keep forgetting about that, I'll consider that in the future. In this case I've used this Handlebars.Net + this in the past at other companies and really liked it. We had started to use it at my current company when I learned we needed to change how naming is handled. I wanted to see if this library was open to making that change before I look at other options.
from entityframeworkcore.scaffolding.handlebars.
from entityframeworkcore.scaffolding.handlebars.
I've got a couple of ideas, I'll spin up a fork and see if I can make it work.
from entityframeworkcore.scaffolding.handlebars.
We also need this functionality as well. Can we also get the ability to know what the foreign table is in these property transformers, like the constructor and nav transformers? We really need to be able to know what the property's foreign table is in the relationship, so we know what to rename the types and property names correctly to.
from entityframeworkcore.scaffolding.handlebars.
Closed #233 pending the .NET 8 upgrade. @mwmccallum, When you have time, we can circle back to have a look at this feature request.
from entityframeworkcore.scaffolding.handlebars.
Related Issues (20)
- [Bug] GenerateManyToMany produces wrong code when using AddHandlebarsTransformers HOT 5
- [Question] How to register multiple propertyTransformer HOT 1
- [Question] EF Core 7 and NET 7 Support Timeline HOT 1
- [Question] DbContext public parameterless ctor added in #220 HOT 8
- [Bug] EF7's HasTrigger is not scaffolded for SQL tables with triggers HOT 3
- GenerateDbSets net setting set-property-name with TransformPropertyName
- EF Core Power Tools HOT 1
- Could not load type Microsoft.EntityFrameworkCore.Scaffolding.Internal.ICSharpDbContextGenerator HOT 3
- Basic Noob Question: Taking Full Control by Extending Handlebars Generators HOT 2
- [Question] Change property's access
- [Question] Support for EF Core 7? HOT 1
- [Typo] Releases labels v7.0.0 as v7.7.0
- T4 Templates vs Scaffolding.Handlebars HOT 4
- [Feature] EF Core 8 plans? HOT 7
- [Bug] Missing Scaffolded Properties in EF Core 8 and EntityFrameworkCore.Scaffolding.Handlebars (8.0.0-beta1) HOT 2
- Multiple Schema scaffold not setting HasForeignKey in HbsCSharpDbContextGenerator with correct Schema name. HOT 2
- Skip InverseProperty and ForeignKey Annotations generation with Virtualized Many To Many Table.
- Setting HasDefaultValue for Enumeration in DBContext generation HOT 1
- Allow setting new value for HasDefaultValue
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entityframeworkcore.scaffolding.handlebars.