Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended Extensions and Command Updates #19

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rogersears02
Copy link
Collaborator

@rogersears02 rogersears02 commented Jun 7, 2024

Renamed commands with a suffix of Command. Added another test command for xUnit tests. Renamed the previous MSTest-related test to MSTest in all of it's references. Created an Extensions Folder in the Standards.Logic project, added several new extensions.

Updated RefreshEFRepositoryCommand, where new config was added that gives the developer an option to create the CRUD operations. By Default, this is set to true, so it will always generate full CRUD operations on the initial repo contracts. When set to false, it will not.

ANGULAR SUPPORT
Added a new local model and service builder. These will generate a local typescript model from a csharp model, implementing a default constructor with default values. (this is currently being used, but several changes were made in this last revision - not fully tested, proceed with caution.

Additional Typescript converters were created. Still in an early stage.

TESTING
Support for MSTest, Bunit, xUnit, and nUnit have been implemented. More love has been provided for generation of xUnit Tests. Still in testing, proceed with caution.

EXTENSIONS
Several new extensions were added, existing extensions were renamed and added to the new Extensions folder.

Calling this one out specifically: I added several String extension methods that do various different things. You can now TrimStart, TrimEnd, TrimStartEnd, Pluralize, Prettify (breaks up a propercased string into string with spaces), and provided conversion from proper casing to kebab-case and snake_case.

TrimStartEndLines()
I did not implement this everywhere, but in the current state of code generation, you get source files with extra blank lines at the beginning and end. When you generate POCO models, there are a lot of extra blank lines within the class body, before and after each property. In another version of this code, every time I see .ReturnSource() I append .ReturnSource().TrimStartEndLines(). You can see this in the RefreshEFRepositoryCommand and in the RepositoryBuilder. The long-term solution here should be that the SDK automatically trims extra lines when the source formatter is returning the source.

ENUMS
I wrote additional extension methods to differentiate a VsDocument (so any file) with IsMarkupCode. This will let you know if the file you are dealing with is a view/presentation layer (html, cshtml, razor, xaml, etc). There are other VSDocument extensions that tell you what UI Frameworks are being used, based on project references, and what file types you're dealing with.

So in the inverse, enums were created to let you dictate/manage your list of UI Frameworks

I added several enums

Renamed commands with a suffix of Command. Added another test command for xUnit tests. Renamed the previous MSTest-related test to MSTest in all of it's references. Created an Extensions Folder in the Standards.Logic project, added several new extensions.

Updated RefreshEFRepositoryCommand, where new config was added that gives the developer an option to ONLY create the CRUD operations, or they can also generate a default QueryAsync method and GetAsync method. QueryAsync currently will return back the first X number of records. In a later update of this method, we will add all non Date and primary key field properties as parameters. We could also use an Expression function to allow for more dynamic IQueryable functionality. The GetAsync method always returns the record, using the First property (usually this will be the primary key) and query the repository for that record.

ANGULAR SUPPORT
Added a new local model and service builder. These will generate a local typescript model from a csharp model, implementing a default constructor with default values. (this is currently being used, but several changes were made in this last revision - not fully tested, proceed with caution.

Additional Typescript converters were created. Still in an early stage.

TESTING
Support for MSTest, Bunit, xUnit, and nUnit have been implemented. More love has been provided for generation of xUnit Tests. Still in testing, proceed with caution.

EXTENSIONS
Several new extensions were added, existing extensions were renamed and added to the new Extensions folder.

Calling this one out specifically: I added several String extension methods that do various different things. You can now TrimStart, TrimEnd, TrimStartEnd, Pluralize, Prettify (breaks up a propercased string into string with spaces), and provided conversion from proper casing to kebab-case and snake_case.

TrimStartEndLines()
I did not implement this everywhere, but in the current state of code generation, you get source files with extra blank lines at the beginning and end. When you generate POCO models, there are a lot of extra blank lines within the class body, before and after each property. In another version of this code, every time I see .ReturnSource() I append .ReturnSource().TrimStartEndLines(). You can see this in the RefreshEFRepositoryCommand and in the RepositoryBuilder.  The long-term solution here should be that the SDK automatically trims extra lines when the source formatter is returning the source.

ENUMS
I wrote additional extension methods to differentiate a VsDocument (so any file) with IsMarkupCode. This will let you know if the file you are dealing with is a view/presentation layer (html, cshtml, razor, xaml, etc). There are other VSDocument extensions that tell you what UI Frameworks are being used, based on project references, and what file types you're dealing with.

So in the inverse, enums were created to let you dictate/manage your list of UI Frameworks

I added several enums
@rogersears02 rogersears02 requested a review from sgiffinlcd June 7, 2024 14:28
…c support for the initial EF Repository builder & contracts. The default behavior includes a config command parameter called GenerateCRUDOperations, which is true by default. If this is set to false, the initial CRUD operations on the EF Repository contract will not generate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant