Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Commit

Permalink
https://github.com/msawczyn/EFDesigner/issues/93
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelSawczyn-AWH committed Sep 11, 2019
1 parent 5512f66 commit 0a04c2f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 748 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Added a model fixup for when user doesn't use full enumeration name for a property's initial value in an entity
- Fix: Removed stray quote marks in default values for string properties (See https://github.com/msawczyn/EFDesigner/issues/86)
- Fix: Minimum string length was ignored when setting properties via text edit (See https://github.com/msawczyn/EFDesigner/issues/86)
- Fix: Required string identity property is not present in the constructor (See https://github.com/msawczyn/EFDesigner/issues/93)

1.3.0.4
- Fixed problematic code generation in constructors for classes having 1..1 associations (See https://github.com/msawczyn/EFDesigner/issues/74)
Expand Down
2 changes: 1 addition & 1 deletion src/Dsl/GeneratedCode/SerializationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ public virtual ModelRoot LoadModel(DslModeling::SerializationResult serializatio
///// <param name="partition">Partition in which the new ModelRoot instance will be created.</param>
///// <param name="fileName">Name of the file from which the ModelRoot instance will be deserialized.</param>
///// <param name="modelRoot">The root of the file that was loaded.</param>
// private void OnPostLoadModel(DslModeling::SerializationResult serializationResult, DslModeling::Partition partition, string fileName, ModelRoot modelRoot )
// private void OnPostLoadModel(DslModeling::SerializationResult serializationResult, DslModeling::Partition partition, string location, ModelRoot modelRoot )

this.OnPostLoadModel(serializationResult, partition, location, modelRoot);
if (serializationResult.Failed)
Expand Down
12 changes: 6 additions & 6 deletions src/DslPackage/TextTemplates/EFDesigner.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults)
if (haveDefaults != true)
{
requiredParameters.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity &&
.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public &&
string.IsNullOrEmpty(x.InitialValue))
Expand All @@ -181,7 +181,7 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults)
if (haveDefaults != false)
{
requiredParameters.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity &&
.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public &&
!string.IsNullOrEmpty(x.InitialValue))
Expand All @@ -199,7 +199,7 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults)
List<string> GetRequiredParameterNames(ModelClass modelClass)
{
List<string> requiredParameterNames = modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && string.IsNullOrEmpty(x.InitialValue))
.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) && && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && string.IsNullOrEmpty(x.InitialValue))
.Select(x => x.Name.ToLower())
.ToList();

Expand All @@ -209,7 +209,7 @@ List<string> GetRequiredParameterNames(ModelClass modelClass)
.Select(x => x.PropertyName.ToLower()));

requiredParameterNames.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && !string.IsNullOrEmpty(x.InitialValue))
.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) && && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && !string.IsNullOrEmpty(x.InitialValue))
.Select(x => x.Name.ToLower()));

return requiredParameterNames;
Expand Down Expand Up @@ -519,7 +519,7 @@ void WriteConstructor(ModelClass modelClass)
}

foreach (ModelAttribute requiredAttribute in modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity &&
.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public))
{
Expand Down Expand Up @@ -626,7 +626,7 @@ bool AllSuperclassesAreNullOrAbstract(ModelClass modelClass)

void WriteConstructorComments(ModelClass modelClass)
{
foreach (ModelAttribute requiredAttribute in modelClass.AllRequiredAttributes.Where(x => !x.IsIdentity &&
foreach (ModelAttribute requiredAttribute in modelClass.AllRequiredAttributes.Where(x => (!x.IsIdentity || x.IdentityType == IdentityType.Manual) &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public))
Output($@"/// <param name=""{requiredAttribute.Name.ToLower()}"">{requiredAttribute.Summary}</param>");
Expand Down
Loading

0 comments on commit 0a04c2f

Please sign in to comment.