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/298
Browse files Browse the repository at this point in the history
  • Loading branch information
msawczyn committed Aug 29, 2021
1 parent 23e468e commit dcbaea0
Show file tree
Hide file tree
Showing 14 changed files with 99 additions and 101 deletions.
8 changes: 4 additions & 4 deletions src/Dsl/CustomCode/Rules/ModelClassChangeRules.cs
Expand Up @@ -144,10 +144,10 @@ public override void ElementPropertyChanged(ElementPropertyChangedEventArgs e)
if (string.IsNullOrEmpty(element.ViewName))
element.ViewName = MakeDefaultTableAndSetName(element.Name);

if (modelRoot.IsEFCore5Plus)
VerifyKeylessTypeEFCore5();
else
VerifyKeylessType();
//if (modelRoot.IsEFCore5Plus)
// VerifyKeylessTypeEFCore5();
//else
// VerifyKeylessType();
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dsl/DslDefinition.dsl
@@ -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="7" 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="7" 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
152 changes: 76 additions & 76 deletions src/Dsl/DslDefinition.dsl.diagram

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/Dsl/GeneratedCode/DomainClasses.cs
Expand Up @@ -13526,6 +13526,6 @@ namespace Sawczyn.EFDesigner.EFModel
/// </summary>
partial class ModelRoot
{
public const string DSLVersion = "3.0.7.1";
public const string DSLVersion = "3.0.7.2";
}
}
4 changes: 2 additions & 2 deletions src/Dsl/GeneratedCode/SerializationHelper.cs
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.7.1");
rootElementSettings.Version = new global::System.Version("3.0.7.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.7.1");
global::System.Version expectedVersion = new global::System.Version("3.0.7.2");
string dslVersionStr = reader.GetAttribute("dslVersion");
if (dslVersionStr != null)
{
Expand Down
13 changes: 0 additions & 13 deletions src/DslPackage/DslPackage.csproj
Expand Up @@ -273,18 +273,6 @@
<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="Logo.ico">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
Expand Down Expand Up @@ -413,7 +401,6 @@
<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
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.7.1";
public const string ProductVersion = "3.0.7.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.
9 changes: 8 additions & 1 deletion src/DslPackage/TextTemplates/EFCore5ModelGenerator.ttinclude
Expand Up @@ -34,10 +34,17 @@
protected override void ConfigureTable(List<string> segments, ModelClass modelClass)
{
string tableName = string.IsNullOrEmpty(modelClass.TableName) ? modelClass.Name : modelClass.TableName;
string viewName = string.IsNullOrEmpty(modelClass.ViewName) ? modelClass.Name : modelClass.ViewName;
string schema = string.IsNullOrEmpty(modelClass.DatabaseSchema) || modelClass.DatabaseSchema == modelClass.ModelRoot.DatabaseSchema ? string.Empty : $", \"{modelClass.DatabaseSchema}\"";
string buildAction = modelClass.ExcludeFromMigrations ? ", t => t.ExcludeFromMigrations()" : string.Empty;

segments.Add($"ToTable(\"{tableName}\"{schema}{buildAction})");
if (modelClass.IsDatabaseView)
segments.Add($"ToView(\"{viewName}\"{schema}{buildAction})");
else
segments.Add($"ToTable(\"{tableName}\"{schema}{buildAction})");

if (modelClass.Superclass != null)
segments.Add($"HasBaseType<{modelClass.Superclass.FullName}>()");

// primary key code segments must be output last, since HasKey returns a different type
List<ModelAttribute> identityAttributes = modelClass.IdentityAttributes.ToList();
Expand Down
Expand Up @@ -19,10 +19,14 @@ public class EFCore5ModelGenerator : EFCore3ModelGenerator
protected override void ConfigureTable(List<string> segments, ModelClass modelClass)
{
string tableName = string.IsNullOrEmpty(modelClass.TableName) ? modelClass.Name : modelClass.TableName;
string viewName = string.IsNullOrEmpty(modelClass.ViewName) ? modelClass.Name : modelClass.ViewName;
string schema = string.IsNullOrEmpty(modelClass.DatabaseSchema) || modelClass.DatabaseSchema == modelClass.ModelRoot.DatabaseSchema ? string.Empty : $", \"{modelClass.DatabaseSchema}\"";
string buildAction = modelClass.ExcludeFromMigrations ? ", t => t.ExcludeFromMigrations()" : string.Empty;

segments.Add($"ToTable(\"{tableName}\"{schema}{buildAction})");
if (modelClass.IsDatabaseView)
segments.Add($"ToView(\"{viewName}\"{schema}{buildAction})");
else
segments.Add($"ToTable(\"{tableName}\"{schema}{buildAction})");

if (modelClass.Superclass != null)
segments.Add($"HasBaseType<{modelClass.Superclass.FullName}>()");
Expand Down
2 changes: 1 addition & 1 deletion src/DslPackage/source.extension.vsixmanifest
@@ -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="3.0.7.1" Language="en-US" Publisher="Michael Sawczyn" />
<Identity Id="56bbe1ba-aaee-4883-848f-e3c8656f8db2" Version="3.0.7.2" 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

0 comments on commit dcbaea0

Please sign in to comment.