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

Commit

Permalink
An entity's concurrency token property is no longer a required parame…
Browse files Browse the repository at this point in the history
…ter in its constructor (#24).
  • Loading branch information
msawczyn committed Sep 21, 2018
1 parent 3c0ccdb commit bf2436c
Show file tree
Hide file tree
Showing 34 changed files with 2,501 additions and 22 deletions.
12 changes: 12 additions & 0 deletions TODO.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,15 @@ T4: Implement soft delete where marked in model
DSL: Add bool Enhanced Cascade Delete
T4: Implement as CascadeDeleteConvention replacement generating delete triggers




-------------------------------------------------------------
Cascade Delete fixes
-------------------------------------------------------------

- In EFCore, change WillCascadeOnDelete calls to OnDelete calls
- Property editor should only show cascade delete options on the principal entity
- Update documentation to discuss cascade deletion propagating from principal to dependents ONLY
reference https://docs.microsoft.com/en-us/ef/core/saving/cascade-delete and http://www.entityframeworktutorial.net/code-first/cascade-delete-in-code-first.aspx

3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
1.2.6.7
- An entity's concurrency token property is no longer a required parameter in its constructor (https://github.com/msawczyn/EFDesigner/issues/24).

1.2.6.6
- Deleting a generalization or superclass gives the choice of pushing attributes and associations down to the former child class(es)

Expand Down
2 changes: 1 addition & 1 deletion src/Dsl/DslDefinition.dsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Dsl xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="9987f227-3d05-49b7-b151-857879f5dfb8" Description="Entity Framework visual editor for EF6, EFCore and beyond." Name="EFModel" DisplayName="Entity Framework Visual Editor" Namespace="Sawczyn.EFDesigner.EFModel" MinorVersion="2" Build="6" Revision="6" ProductName="EFDesigner" CompanyName="Michael Sawczyn" PackageGuid="56bbe1ba-aaee-4883-848f-e3c8656f8db2" PackageNamespace="Sawczyn.EFDesigner.EFModel" xmlns="http://schemas.microsoft.com/VisualStudio/2005/DslTools/DslDefinitionModel">
<Dsl xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="9987f227-3d05-49b7-b151-857879f5dfb8" Description="Entity Framework visual editor for EF6, EFCore and beyond." Name="EFModel" DisplayName="Entity Framework Visual Editor" Namespace="Sawczyn.EFDesigner.EFModel" MinorVersion="2" Build="6" Revision="7" ProductName="EFDesigner" CompanyName="Michael Sawczyn" PackageGuid="56bbe1ba-aaee-4883-848f-e3c8656f8db2" PackageNamespace="Sawczyn.EFDesigner.EFModel" xmlns="http://schemas.microsoft.com/VisualStudio/2005/DslTools/DslDefinitionModel">
<Classes>
<DomainClass Id="95532cb8-3452-4b09-a654-aeb2e2d0b3ad" Description="" Name="ModelRoot" DisplayName="Entity Model" Namespace="Sawczyn.EFDesigner.EFModel">
<CustomTypeDescriptor>
Expand Down
4 changes: 2 additions & 2 deletions src/Dsl/GeneratedCode/SerializationHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1168,7 +1168,7 @@ public virtual void WriteRootElement(DslModeling::SerializationContext serializa
// Only model has schema, diagram has no schema.
rootElementSettings.SchemaTargetNamespace = "http://schemas.microsoft.com/dsltools/EFModel";
}
rootElementSettings.Version = new global::System.Version("1.2.6.6");
rootElementSettings.Version = new global::System.Version("1.2.6.7");

// Carry out the normal serialization.
rootSerializer.Write(serializationContext, rootElement, writer, rootElementSettings);
Expand All @@ -1190,7 +1190,7 @@ protected virtual void CheckVersion(DslModeling::SerializationContext serializat
throw new global::System.ArgumentNullException("reader");
#endregion

global::System.Version expectedVersion = new global::System.Version("1.2.6.6");
global::System.Version expectedVersion = new global::System.Version("1.2.6.7");
string dslVersionStr = reader.GetAttribute("dslVersion");
if (dslVersionStr != null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/GeneratedCode/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal static partial class Constants
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
public const string CompanyName = @"Michael Sawczyn";
[global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")]
public const string ProductVersion = "1.2.6.6";
public const string ProductVersion = "1.2.6.7";

// Menu definitions
public static readonly global::System.ComponentModel.Design.CommandID EFModelDiagramMenu = new global::System.ComponentModel.Design.CommandID(new global::System.Guid(EFModelCommandSetId), 0x10000);
Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/TextTemplates/EF6Designer.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#><#@ import namespace="System.IO"
#><#@ import namespace="System.Linq" #><#+

// EFDesigner v1.2.6.6
// EFDesigner v1.2.6.7
// Copyright (c) 2017-2018 Michael Sawczyn
// https://github.com/msawczyn/EFDesigner

Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/TextTemplates/EFCoreDesigner.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#><#@ import namespace="System.IO"
#><#@ import namespace="System.Linq" #><#+

// EFDesigner v1.2.6.6
// EFDesigner v1.2.6.7
// Copyright (c) 2017-2018 Michael Sawczyn
// https://github.com/msawczyn/EFDesigner

Expand Down
27 changes: 14 additions & 13 deletions src/DslPackage/TextTemplates/EFDesigner.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#><#@ import namespace="System.IO"
#><#@ import namespace="System.Linq" #><#+

// EFDesigner v1.2.6.6
// EFDesigner v1.2.6.7
// Copyright (c) 2017-2018 Michael Sawczyn
// https://github.com/msawczyn/EFDesigner

Expand Down Expand Up @@ -142,6 +142,7 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults = n
{
requiredParameters.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public &&
string.IsNullOrEmpty(x.InitialValue))
.Select(x => $"{x.FQPrimitiveType} _{x.Name.ToLower()}"));
Expand All @@ -153,14 +154,16 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults = n
if (haveDefaults != false)
{
requiredParameters.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity && x.SetterVisibility == SetterAccessModifier.Public &&
!string.IsNullOrEmpty(x.InitialValue))
.Select(x =>
{
string quote = x.PrimitiveType == "string" ? "\"" : x.PrimitiveType == "char" ? "'" : "";
string value = FullyQualified(modelClass.ModelRoot, x.InitialValue.Trim('"', '\''));
return $"{x.FQPrimitiveType} _{x.Name.ToLower()} = {quote}{value}{quote}";
}));
.Where(x => !x.IsIdentity &&
!x.IsConcurrencyToken &&
x.SetterVisibility == SetterAccessModifier.Public &&
!string.IsNullOrEmpty(x.InitialValue))
.Select(x =>
{
string quote = x.PrimitiveType == "string" ? "\"" : x.PrimitiveType == "char" ? "'" : "";
string value = FullyQualified(modelClass.ModelRoot, x.InitialValue.Trim('"', '\''));
return $"{x.FQPrimitiveType} _{x.Name.ToLower()} = {quote}{value}{quote}";
}));
}

return requiredParameters;
Expand All @@ -169,17 +172,15 @@ List<string> GetRequiredParameters(ModelClass modelClass, bool? haveDefaults = n
List<string> GetRequiredParameterNames(ModelClass modelClass)
{
List<string> requiredParameterNames = modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity && x.SetterVisibility == SetterAccessModifier.Public &&
string.IsNullOrEmpty(x.InitialValue))
.Where(x => !x.IsIdentity && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && string.IsNullOrEmpty(x.InitialValue))
.Select(x => $"_{x.Name.ToLower().Trim('_')}")
.ToList();

requiredParameterNames.AddRange(modelClass.AllRequiredNavigationProperties()
.Select(x => $"_{x.PropertyName.ToLower().Trim('_')}"));

requiredParameterNames.AddRange(modelClass.AllRequiredAttributes
.Where(x => !x.IsIdentity && x.SetterVisibility == SetterAccessModifier.Public &&
!string.IsNullOrEmpty(x.InitialValue))
.Where(x => !x.IsIdentity && !x.IsConcurrencyToken && x.SetterVisibility == SetterAccessModifier.Public && !string.IsNullOrEmpty(x.InitialValue))
.Select(x => $"_{x.Name.ToLower().Trim('_')}"));

return requiredParameterNames;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#><#@ import namespace="Microsoft.VisualStudio.TextTemplating"
#><#+

// EFDesigner v1.2.6.6
// EFDesigner v1.2.6.7
// Copyright (c) 2017-2018 Michael Sawczyn
// https://github.com/msawczyn/EFDesigner
//
Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/TextTemplates/VSIntegration.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#><#@ import namespace="Microsoft.VisualStudio.TextTemplating"
#><#+

// EFDesigner v1.2.6.6
// EFDesigner v1.2.6.7
// https://github.com/msawczyn/EFDesigner

// this bit is thanks to Simon Hughes and his EntityFramework Reverse POCO Code First Generator
Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="56bbe1ba-aaee-4883-848f-e3c8656f8db2" Version="1.2.6.6" Language="en-US" Publisher="Michael Sawczyn" />
<Identity Id="56bbe1ba-aaee-4883-848f-e3c8656f8db2" Version="1.2.6.7" Language="en-US" Publisher="Michael Sawczyn" />
<DisplayName>Entity Framework Visual Editor</DisplayName>
<Description>Entity Framework visual editor for EF6, EFCore and beyond.</Description>
<Icon>Logo.ico</Icon>
Expand Down
Loading

0 comments on commit bf2436c

Please sign in to comment.