TrackableEntities / EntityFrameworkCore.Scaffolding.Handlebars

Scaffold EF Core models using Handlebars templates.
MIT License
208 stars 53 forks source link

Basic Noob Question: Taking Full Control by Extending Handlebars Generators #226

Open glconsultingservice opened 1 year ago

glconsultingservice commented 1 year ago

I have no idea how to even implement this.. I am using EF Power Tools to generate the code for my tables. I have much need to customize the output of the code. I am using the CodeTemplates folder that it created to modify what I can in the CSHarpEntityType folder and the class.hbs. But I need much more control over the class-annotations and the properties.

I see you example of how to do it, but I have no idea where to place that code. As it can't compile within my project. And how would the EF power tool know to use it.

So speak to me as if I am truly not understanding how to do this.

I have no idea how to do half of the examples you provided and make them apply to my project. I have pulled down the project, but again not sure how that helps me because the project isn't going to be used to generate the code.

I spent the last several days trying to figure it out, but I am lost...

Any help would be appreciated, thank you for you patients on my lack of understanding.

tonysneed commented 1 year ago

For an example of how to do this, please have a look at the classes in this repo: https://github.com/TrackableEntities/ef-core-community-handlebars/blob/master/ScaffoldingHandlebars.Tooling/MyHbsCSharpEntityTypeGenerator.cs

glconsultingservice commented 1 year ago

I have already been to that page. But how do I compile that and use that for the handlebar template. Your example is leaving out how to use it, from the start.

If I added that class, first of all it wont compile because the references don’t exist within my project. Your how to is not telling us how to begin, it is jumping straight to the class extension. But leaving out the first 10 steps on how to implement the extension.

Steps:

  1. Open your project.
  2. Add the References for the Handlebars (What is the proper way, use NuGet?)?
  3. Add the Extension Class to your project
    • Add your custom extensions or override the existing methods
  4. How to use the Extended class ???
  5. How to tell the Handlebars to use the custom version for EF Power Tools(Which is using the default version of the DLL)?

As I stated it was a noob question, but your example set assumes we should know the basic steps you have left out.

My project is a simple DLL project that I have my Database models in for EF Core. @.***

I am missing a piece of the information that tells me how to use the custom code and compile it. Then have the EF Power Tools use my custom version of the DLL rather than the released version.

From: Anthony Sneed @.> Sent: Thursday, March 23, 2023 3:28 PM To: TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars @.> Cc: Glen Lewis @.>; Author @.> Subject: Re: [TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars] Basic Noob Question: Taking Full Control by Extending Handlebars Generators (Issue #226)

For an example of how to do this, please have a look at the classes in this repo: https://github.com/TrackableEntities/ef-core-community-handlebars/blob/master/ScaffoldingHandlebars.Tooling/MyHbsCSharpEntityTypeGenerator.cs

— Reply to this email directly, view it on GitHubhttps://github.com/TrackableEntities/EntityFrameworkCore.Scaffolding.Handlebars/issues/226#issuecomment-1481851417, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AWA6TQRXVRCDIKVWWPKTPCDW5SW5HANCNFSM6AAAAAAWFTMQII. You are receiving this because you authored the thread.Message ID: @.**@.>>