You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+55Lines changed: 55 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,3 +323,58 @@ public class ScaffoldingDesignTimeServices : IDesignTimeServices
323
323
}
324
324
}
325
325
```
326
+
327
+
## Taking Full Control by Extending Handlebars Generators
328
+
329
+
> For an example of this approach, see `MyHbsCSharpEntityTypeGenerator` in the [ef-core-community-handlebars](https://github.com/TrackableEntities/ef-core-community-handlebars/blob/master/ScaffoldingHandlebars.Tooling/MyHbsCSharpEntityTypeGenerator.cs) repo.
330
+
331
+
To take full control of context and entity generation, you can extend `HbsCSharpDbContextGenerator` and `HbsCSharpEntityTypeGenerator`, overriding select virtual methods. Then register your custom generators in `ScaffoldingDesignTimeServices.ConfigureDesignTimeServices`.
332
+
333
+
For example, you may want to add `property-isprimarykey` to the template data in order to insert some code or a comment.
334
+
335
+
1. Add a `MyHbsCSharpEntityTypeGenerator` to the **.Tooling** project.
336
+
- Extend `HbsCSharpEntityTypeGenerator`.
337
+
- Override `GenerateProperties`.
338
+
- Copy code from the base `GenerateProperties` method.
339
+
- Add code that inserts `property-isprimarykey` into the template data.
0 commit comments