Closed heggi closed 12 months ago
Thanks for the feedback. It makes totally sense.
Since there could be several attributes, I'd prefer to define it as a string array instead of a simple string. Just to simplify the life of who is going to write the attributes. Then it won't be necessary to handle the EOL, square brackets and some other tedious little problems. For the placeholder it shouldn't be a problem, since it's already defined. I'd keep the existing syntax ${classname}
.
Based on your example it will look like so:
"csharpextensions.templates": {
"items": [
{
...
"construct": "class",
"attributes": [
"DbContext(typeof(AppDbContext))",
"Migration(\"${classname}\""
]
}
]
},
Some templates require add some attributes to class definition with placeholders
For example database migration template:
I need option to add attributes
DbContext
andMigration
to class definition. Also attributeMigration
must contain class name as his parameter.Implementation example:
Add new parameter
attribute
(or other name) to template definition with placeholder replacer. Example: