-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Entity Framework Child\Parent relationship generation (#179)
* add generator attributes to foreign key gens * output text to unit test logger * moved foreign key logic away from the old t4 gen model * now generating the one to many interface * adjust type parsing to use ParseTypeName * add foreign key property * add the child relationship generation * removed defunct test from cgr no longer using attributes to drive config * fixed key gen and sample data * add inherited documentation * padding out the ef model generation * ef model now generating foreign entities * ef logic now builds in sample app * corrected ef model generation for relationships * prep for entitytype config range constraints * prep for min and max value constraints * Update version.json * prep of relationship mapping in entity type config * add more event id's * change primary key generation as now explicit * fixed null ref when no properties in a ef table * invocation logic for child\parent relationships * removing static keyword from private methods micro optimisation and going to add logging down the road
- Loading branch information
Showing
50 changed files
with
889 additions
and
194 deletions.
There are no files selected for viewing
43 changes: 29 additions & 14 deletions
43
src/Dhgms.Nucleotide.GenerationTests/EventIdExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,34 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace Dhgms.Nucleotide.GenerationTests | ||
namespace Dhgms.Nucleotide.GenerationTests | ||
{ | ||
public static class NumericEventIds | ||
{ | ||
public const int UserControllerAddId = 1; | ||
public const int UserControllerOnAddNotifySignalRId = 2; | ||
public const int UserControllerDeleteId = 3; | ||
public const int UserControllerOnDeleteNotifySignalRId = 4; | ||
public const int UserControllerListId = 5; | ||
public const int UserControllerUpdateId = 6; | ||
public const int UserControllerOnUpdateNotifySignalRId = 7; | ||
public const int UserControllerViewId = 8; | ||
public const int UserControllerAddId = 1, | ||
UserControllerOnAddNotifySignalRId = 2, | ||
UserControllerDeleteId = 3, | ||
UserControllerOnDeleteNotifySignalRId = 4, | ||
UserControllerListId = 5, | ||
UserControllerUpdateId = 6, | ||
UserControllerOnUpdateNotifySignalRId = 7, | ||
UserControllerViewId = 8, | ||
AddressControllerAddId = 9, | ||
AddressControllerDeleteId = 10, | ||
AddressControllerListId = 11, | ||
AddressControllerUpdateId = 12, | ||
AddressControllerViewId = 13, | ||
GenderControllerAddId = 14, | ||
GenderControllerDeleteId = 15, | ||
GenderControllerListId = 16, | ||
GenderControllerUpdateId= 17, | ||
GenderControllerViewId = 18, | ||
PersonControllerAddId = 19, | ||
PersonControllerDeleteId = 20, | ||
PersonControllerListId = 21, | ||
PersonControllerUpdateId = 22, | ||
PersonControllerViewId = 23, | ||
SalutationControllerAddId = 24, | ||
SalutationControllerDeleteId = 25, | ||
SalutationControllerListId = 26, | ||
SalutationControllerUpdateId = 27, | ||
SalutationControllerViewId= 28; | ||
} | ||
} |
5 changes: 1 addition & 4 deletions
5
src/Dhgms.Nucleotide.Generators/Features/Database/ForiegnKeyInterfaceFeatureFlags.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/Dhgms.Nucleotide.Generators/Features/Database/ForiegnKeyInterfaceGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
src/Dhgms.Nucleotide.Generators/Features/Database/ReferencedByEntityGenerationModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
using Dhgms.Nucleotide.Generators.GeneratorProcessors; | ||
|
||
namespace Dhgms.Nucleotide.Generators.Features.Database | ||
{ | ||
/// <summary> | ||
/// Generation Model for a One to Many Relationship | ||
/// </summary> | ||
public sealed class ReferencedByEntityGenerationModel : IClassName | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
/// <param name="namespaceForInterface">The namespace the interface will be located in.</param> | ||
/// <param name="entityName">The name of the entity.</param> | ||
/// <param name="entityType">The type for the entity</param> | ||
/// <param name="propertyName">The name of the navigation property</param> | ||
/// <param name="keyType">The type for the foreign key.</param> | ||
public ReferencedByEntityGenerationModel( | ||
string namespaceForInterface, | ||
string entityName, | ||
string entityType, | ||
string singularPropertyName, | ||
string pluralPropertyName, | ||
string keyType) | ||
{ | ||
NamespaceForInterface = namespaceForInterface; | ||
ClassName = entityName; | ||
EntityType = entityType; | ||
SingularPropertyName = singularPropertyName; | ||
PluralPropertyName = pluralPropertyName; | ||
KeyType = keyType; | ||
} | ||
|
||
/// <summary> | ||
/// Gets the namespace the interface will be located in. | ||
/// </summary> | ||
public string NamespaceForInterface { get; } | ||
|
||
/// <summary> | ||
/// Gets the name of the entity. | ||
/// </summary> | ||
public string ClassName { get; } | ||
|
||
/// <summary> | ||
/// Gets the type for the entity. | ||
/// </summary> | ||
public string EntityType { get; } | ||
|
||
/// <summary> | ||
/// Gets the singular name of the navigation property. | ||
/// </summary> | ||
public string SingularPropertyName { get; } | ||
|
||
/// <summary> | ||
/// Gets the plural name of the navigation property. | ||
/// </summary> | ||
public string PluralPropertyName { get; } | ||
|
||
/// <summary> | ||
/// Gets the type for the foreign key. | ||
/// </summary> | ||
public string KeyType { get; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/Dhgms.Nucleotide.Generators/Features/Dto/RequestDtoClassGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
src/Dhgms.Nucleotide.Generators/Features/Dto/ResponseDtoClassGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...de.Generators/Features/EntityFramework/EntityFrameworkEntityTypeConfigurationGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.