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

Commit

Permalink
Update version number, changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
msawczyn committed May 6, 2021
1 parent 9d4c634 commit 462c7db
Show file tree
Hide file tree
Showing 23 changed files with 207 additions and 48 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,21 @@ to <a href="https://www.jetbrains.com/?from=EFDesigner"><img src="https://msawcz

### Change Log

**3.0.4**
**3.0.5**
- Fix where parsing EF version numbers should be culture-neutral
- Corrected tracking property access modes from the default to overrides in entity attributes

<details>
<summary><b>3.0.4</b></summary>

- Added context menu choice to visually align node elements on diagrams.
- Fix for detecting correct EF version when anything with "Latest" in it is configured (see https://github.com/msawczyn/EFDesigner/issues/266)
- Fix to generate correct initial value code for decimal properties (see https://github.com/msawczyn/EFDesigner/issues/268)
- Fix for constructor code generation in 1-N unidirectional associations (see https://github.com/msawczyn/EFDesigner/issues/263)
- Removed addition of default objects in constructors for required associations for all EF versions (see https://github.com/msawczyn/EFDesigner/issues/271)

</details>

<details>
<summary><b>3.0.3</b></summary>

Expand All @@ -77,6 +85,7 @@ to <a href="https://www.jetbrains.com/?from=EFDesigner"><img src="https://msawcz
- Fix to generate correct DeleteBehavior enum values in EFCore < v3 (see https://github.com/msawczyn/EFDesigner/issues/257)
- Removed INotifyPropertyChanged option from designer. Implementers wanting this interface can add it to a partial class file as any other interface, as there's really nothing special about it.
- Generated code now honors the ExcludeFromMigration setting for a class

</details>

<details>
Expand All @@ -92,6 +101,7 @@ to <a href="https://www.jetbrains.com/?from=EFDesigner"><img src="https://msawcz
- Fixed condition where sometimes generated code in entity default constructors would create infinitely recursive calls
- Stopped escaping standard XML comment tags in summary and description fields (see https://github.com/msawczyn/EFDesigner/issues/248)
- Due to the new seeding needs in EFCore5, setters for identity properties are now public even if set to be auto-generated

</details>

<details>
Expand Down
4 changes: 4 additions & 0 deletions VSMarketplace blurb.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ For comprehensive documentation, please visit [the project's documentation site]

**ChangeLog**

**3.0.5**
- Fix where parsing EF version numbers should be culture-neutral
- Corrected tracking property access modes from the default to overrides in entity attributes

**3.0.4**
- **[NEW]** Added context menu choice to visually align node elements on diagrams.
- Fix for detecting correct EF version when anything with "Latest" in it is configured (see https://github.com/msawczyn/EFDesigner/issues/266)
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
3.0.5
- Fix where parsing EF version numbers should be culture-neutral
- Corrected tracking property access modes from the default to overrides in entity attributes

3.0.4
- Added context menu choice to visually align node elements on diagrams.
- Fix for detecting correct EF version when anything with "Latest" in it is configured (see https://github.com/msawczyn/EFDesigner/issues/266)
Expand Down
Binary file modified dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix
Binary file not shown.
17 changes: 9 additions & 8 deletions src/Dsl/CustomCode/Partials/ModelAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class ModelAttribute : IModelElementInCompartment, IDisplaysWarni
/// <summary>
/// If true, this property is an exposed foreign key for an association.
/// </summary>
[UsedImplicitly]
public bool IsForeignKeyProperty => IsForeignKeyFor != Guid.Empty;

internal string BackingFieldNameDefault => string.IsNullOrEmpty(Name) ? string.Empty : $"_{Name.Substring(0, 1).ToLowerInvariant()}{Name.Substring(1)}";
Expand Down Expand Up @@ -110,12 +111,14 @@ public bool SupportsInitialValue
}
}


/// <summary>
/// Tests if the InitialValue property is valid for the type indicated
/// </summary>
/// <param name="typeName">Name of type to test. If typeName is null, Type property will be used. If initialValue is null, InitialValue property will be used</param>
/// <param name="initialValue">Initial value to test</param>
/// <returns>true if InitialValue is a valid value for the type, or if initialValue is null or empty</returns>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0049:Simplify Names", Justification = "By design")]
public bool IsValidInitialValue(string typeName = null, string initialValue = null)
{
typeName = typeName ?? Type;
Expand Down Expand Up @@ -572,28 +575,28 @@ public void SetAutoPropertyValue(bool value)
/// <summary>Storage for the PropertyAccessMode property.</summary>
private PropertyAccessMode propertyAccessModeStorage;

internal PropertyAccessMode DefaultPropertyAccessMode => ModelClass?.ModelRoot.IsEFCore5Plus == true ? PropertyAccessMode.PreferField : PropertyAccessMode.PreferFieldDuringConstruction;

/// <summary>Gets the storage for the PropertyAccessMode property.</summary>
/// <returns>The AutoProperty value.</returns>
public PropertyAccessMode GetPropertyAccessModeValue()
{
if (!this.IsLoading() && IsPropertyAccessModeTracking)
{
PropertyAccessMode defaultResult = ModelClass?.ModelRoot.IsEFCore5Plus == true ? PropertyAccessMode.PreferField : PropertyAccessMode.PreferFieldDuringConstruction;

try
{
return ModelClass?.ModelRoot.PropertyAccessModeDefault ?? defaultResult;
return ModelClass?.ModelRoot.PropertyAccessModeDefault ?? DefaultPropertyAccessMode;
}
catch (NullReferenceException)
{
return defaultResult;
return DefaultPropertyAccessMode;
}
catch (Exception e)
{
if (CriticalException.IsCriticalException(e))
throw;

return defaultResult;
return DefaultPropertyAccessMode;
}
}

Expand All @@ -608,9 +611,7 @@ public void SetPropertyAccessModeValue(PropertyAccessMode value)

if (!Store.InUndoRedoOrRollback && !this.IsLoading())
{
PropertyAccessMode defaultResult = ModelClass?.ModelRoot.IsEFCore5Plus == true ? PropertyAccessMode.PreferField : PropertyAccessMode.PreferFieldDuringConstruction;

IsPropertyAccessModeTracking = (propertyAccessModeStorage == (ModelClass?.ModelRoot.PropertyAccessModeDefault ?? defaultResult));
IsPropertyAccessModeTracking = (propertyAccessModeStorage == (ModelClass?.ModelRoot.PropertyAccessModeDefault ?? DefaultPropertyAccessMode));
}
}

Expand Down
22 changes: 20 additions & 2 deletions src/Dsl/CustomCode/Rules/ModelRootChangeRules.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,24 @@ public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
{
element.InheritanceStrategy = CodeStrategy.TablePerHierarchy;
store.ElementDirectory.AllElements.OfType<ModelClass>().Where(c => c.IsPropertyBag).ToList().ForEach(c => c.IsPropertyBag = false);

switch (element.PropertyAccessModeDefault)
{
case PropertyAccessMode.PreferField:
case PropertyAccessMode.PreferFieldDuringConstruction:
case PropertyAccessMode.PreferProperty:
element.PropertyAccessModeDefault = PropertyAccessMode.FieldDuringConstruction;

store.ElementDirectory.AllElements.OfType<ModelAttribute>()
.Where(a => !a.IsPropertyAccessModeTracking
&& (a.PropertyAccessMode == PropertyAccessMode.PreferField
|| a.PropertyAccessMode == PropertyAccessMode.PreferProperty
|| a.PropertyAccessMode == PropertyAccessMode.PreferFieldDuringConstruction))
.ToList()
.ForEach(a => a.PropertyAccessMode = PropertyAccessMode.FieldDuringConstruction);

break;
}
}

break;
Expand Down Expand Up @@ -167,7 +185,7 @@ public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
foreach (EFModelDiagram diagram in element.GetDiagrams())
diagram.GridColor = (Color)e.NewValue;

redraw = true;
redraw = true;

break;

Expand Down Expand Up @@ -225,7 +243,7 @@ public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
diagram.ShowGrid = (bool)e.NewValue;

redraw = true;

break;

case "ShowInterfaceIndicators":
Expand Down
4 changes: 2 additions & 2 deletions 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" MajorVersion="3" Build="5" Revision="1" 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" MajorVersion="3" Build="5" Revision="2" 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 Expand Up @@ -320,7 +320,7 @@
<ExternalTypeMoniker Name="/System/String" />
</Type>
</DomainProperty>
<DomainProperty Id="51108d30-911e-496c-9b41-99d297f287c3" Description="Default property access mode for backing fields" Name="PropertyAccessModeDefault" DisplayName="Property Access Mode Default" Category="Code Generation">
<DomainProperty Id="51108d30-911e-496c-9b41-99d297f287c3" Description="Default property access mode for backing fields" Name="PropertyAccessModeDefault" DisplayName="Property Access Mode Default" DefaultValue="FieldDuringConstruction" Category="Code Generation">
<Type>
<DomainEnumerationMoniker Name="PropertyAccessMode" />
</Type>
Expand Down
5 changes: 3 additions & 2 deletions src/Dsl/GeneratedCode/DomainClasses.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3900,7 +3900,7 @@ public override sealed void SetValue(ModelRoot element, global::System.String ne
/// <summary>
/// Storage for PropertyAccessModeDefault
/// </summary>
private PropertyAccessMode propertyAccessModeDefaultPropertyStorage;
private PropertyAccessMode propertyAccessModeDefaultPropertyStorage = PropertyAccessMode.FieldDuringConstruction;

/// <summary>
/// Gets or sets the value of PropertyAccessModeDefault domain property.
Expand All @@ -3909,6 +3909,7 @@ public override sealed void SetValue(ModelRoot element, global::System.String ne
[DslDesign::DisplayNameResource("Sawczyn.EFDesigner.EFModel.ModelRoot/PropertyAccessModeDefault.DisplayName", typeof(global::Sawczyn.EFDesigner.EFModel.EFModelDomainModel), "Sawczyn.EFDesigner.EFModel.GeneratedCode.DomainModelResx")]
[DslDesign::CategoryResource("Sawczyn.EFDesigner.EFModel.ModelRoot/PropertyAccessModeDefault.Category", typeof(global::Sawczyn.EFDesigner.EFModel.EFModelDomainModel), "Sawczyn.EFDesigner.EFModel.GeneratedCode.DomainModelResx")]
[DslDesign::DescriptionResource("Sawczyn.EFDesigner.EFModel.ModelRoot/PropertyAccessModeDefault.Description", typeof(global::Sawczyn.EFDesigner.EFModel.EFModelDomainModel), "Sawczyn.EFDesigner.EFModel.GeneratedCode.DomainModelResx")]
[global::System.ComponentModel.DefaultValue(PropertyAccessMode.FieldDuringConstruction)]
[DslModeling::DomainObjectId("51108d30-911e-496c-9b41-99d297f287c3")]
public PropertyAccessMode PropertyAccessModeDefault
{
Expand Down Expand Up @@ -13525,6 +13526,6 @@ namespace Sawczyn.EFDesigner.EFModel
/// </summary>
partial class ModelRoot
{
public const string DSLVersion = "3.0.5.1";
public const string DSLVersion = "3.0.5.2";
}
}
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("3.0.5.1");
rootElementSettings.Version = new global::System.Version("3.0.5.2");

// 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("3.0.5.1");
global::System.Version expectedVersion = new global::System.Version("3.0.5.2");
string dslVersionStr = reader.GetAttribute("dslVersion");
if (dslVersionStr != null)
{
Expand Down
5 changes: 4 additions & 1 deletion src/Dsl/GeneratedCode/Serializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2192,7 +2192,10 @@ protected override void WritePropertiesAsAttributes(DslModeling::SerializationCo
string serializedPropValue = DslModeling::SerializationUtilities.GetString<PropertyAccessMode>(serializationContext, propValue);
if (!serializationContext.Result.Failed)
{
EFModelSerializationHelper.Instance.WriteAttributeString(serializationContext, element, writer, "propertyAccessModeDefault", serializedPropValue);
if (serializationContext.WriteOptionalPropertiesWithDefaultValue || string.CompareOrdinal(serializedPropValue, "FieldDuringConstruction") != 0)
{ // No need to write the value out if it's the same as default value.
EFModelSerializationHelper.Instance.WriteAttributeString(serializationContext, element, writer, "propertyAccessModeDefault", serializedPropValue);
}
}
}
// UseTabs
Expand Down
13 changes: 13 additions & 0 deletions src/DslPackage/DslPackage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,18 @@
<Content Include="TextTemplates\EFModelGenerator.ttinclude">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Compile Include="TextTemplates\EditingOnly\EF6Designer.cs" />
<Compile Include="TextTemplates\EditingOnly\EF6ModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\EFCore2ModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\EFCore3ModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\EFCore5ModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\EFCoreDesigner.cs" />
<Compile Include="TextTemplates\EditingOnly\EFCoreModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\EFDesigner.cs" />
<Compile Include="TextTemplates\EditingOnly\EFModelFileManager.cs" />
<Compile Include="TextTemplates\EditingOnly\EFModelGenerator.cs" />
<Compile Include="TextTemplates\EditingOnly\MultipleOutputHelper.cs" />
<Compile Include="TextTemplates\EditingOnly\VSIntegration.cs" />
<Compile Include="VSPackage.Designer.cs" />
<Content Include="GeneratedCode\GeneratedVSCT.vsct">
<Generator>VsctGenerator</Generator>
Expand Down Expand Up @@ -395,6 +407,7 @@
<Content Include="TextTemplates\VSIntegration.ttinclude">
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="TextTemplates\EditingOnly\_ReadMe.md" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Dsl\Dsl.csproj">
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 = "3.0.5.1";
public const string ProductVersion = "3.0.5.2";

// 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
Binary file modified src/DslPackage/Parsers/EF6Parser.exe
Binary file not shown.
Binary file modified src/DslPackage/Parsers/EFCore2Parser.exe
Binary file not shown.
Binary file modified src/DslPackage/Parsers/EFCore3Parser.exe
Binary file not shown.
Binary file modified src/DslPackage/Parsers/EFCore5Parser.exe
Binary file not shown.
5 changes: 1 addition & 4 deletions src/DslPackage/TextTemplates/EF6ModelGenerator.ttinclude
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
}
}

[SuppressMessage("ReSharper", "RedundantNameQualifier")]
private string CreateForeignKeySegment(Association association, List<string> foreignKeyColumns)
{
// foreign key definitions always go in the table representing the Dependent end of the association
Expand All @@ -83,7 +82,7 @@
else
return null;

string[] columnNameList = null;
string[] columnNameList;

// shadow properties
if (string.IsNullOrWhiteSpace(association.FKPropertyName))
Expand Down Expand Up @@ -119,7 +118,6 @@
return $"Map(x => x.MapKey({string.Join(", ", columnNameList.Select(n => $"\"{n}\""))}))";
}

[SuppressMessage("ReSharper", "RedundantNameQualifier")]
private void DefineBidirectionalAssociations(ModelClass modelClass
, List<Association> visited
, List<string> segments
Expand Down Expand Up @@ -241,7 +239,6 @@
}
}

[SuppressMessage("ReSharper", "RedundantNameQualifier")]
private void DefineUnidirectionalAssociations(ModelClass modelClass
, List<Association> visited
, List<string> segments
Expand Down
Loading

0 comments on commit 462c7db

Please sign in to comment.