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

Commit

Permalink
v3.0.0.preview3
Browse files Browse the repository at this point in the history
  • Loading branch information
msawczyn committed Nov 23, 2020
1 parent 4155d30 commit 4c79950
Show file tree
Hide file tree
Showing 41 changed files with 539 additions and 4,503 deletions.
Binary file modified dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix
Binary file not shown.
20 changes: 19 additions & 1 deletion src/Dsl/DslDefinition.dsl
Expand Up @@ -1758,7 +1758,7 @@
<ShapeHasDecorators Position="InnerTopLeft" HorizontalOffset="0" VerticalOffset="0">
<IconDecorator Name="TransientGlyph" DisplayName="Transient Glyph" DefaultIcon="Resources\TransientClass.png" />
</ShapeHasDecorators>
<ShapeHasDecorators Position="InnerTopLeft" HorizontalOffset="0" VerticalOffset="0">
<ShapeHasDecorators Position="InnerTopLeft" HorizontalOffset="0.01" VerticalOffset="0">
<IconDecorator Name="NoGenGlyph" DisplayName="No Code Generation" DefaultIcon="Resources\No.png" />
</ShapeHasDecorators>
<ShapeHasDecorators Position="InnerTopLeft" HorizontalOffset="0" VerticalOffset="0">
Expand Down Expand Up @@ -2847,6 +2847,24 @@
</PropertyFilters>
</VisibilityPropertyPath>
</DecoratorMap>
<DecoratorMap>
<IconDecoratorMoniker Name="ClassShape/SQLGlyph" />
<VisibilityPropertyPath>
<DomainPropertyMoniker Name="ModelClass/GlyphType" />
<PropertyFilters>
<PropertyFilter FilteringValue="SQLGlyph" />
</PropertyFilters>
</VisibilityPropertyPath>
</DecoratorMap>
<DecoratorMap>
<IconDecoratorMoniker Name="ClassShape/DictionaryGlyph" />
<VisibilityPropertyPath>
<DomainPropertyMoniker Name="ModelClass/GlyphType" />
<PropertyFilters>
<PropertyFilter FilteringValue="DictionaryGlyph" />
</PropertyFilters>
</VisibilityPropertyPath>
</DecoratorMap>
<CompartmentShapeMoniker Name="ClassShape" />
<CompartmentMap DisplaysCustomString="true">
<CompartmentMoniker Name="ClassShape/AttributesCompartment" />
Expand Down
174 changes: 87 additions & 87 deletions src/Dsl/DslDefinition.dsl.diagram

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/Dsl/GeneratedCode/Diagram.cs
Expand Up @@ -403,6 +403,14 @@ public static void OnDecoratorsInitialized(object sender, global::System.EventAr
propertyInfo = new DslDiagrams::AssociatedPropertyInfo(global::Sawczyn.EFDesigner.EFModel.ModelClass.GenerateCodeDomainPropertyId);
propertyInfo.FilteringValues.Add("False");
DslDiagrams::ShapeElement.FindDecorator(shape.Decorators, "NoGenGlyph").AssociateVisibilityWith(shape.Store, propertyInfo);

propertyInfo = new DslDiagrams::AssociatedPropertyInfo(global::Sawczyn.EFDesigner.EFModel.ModelClass.GlyphTypeDomainPropertyId);
propertyInfo.FilteringValues.Add("SQLGlyph");
DslDiagrams::ShapeElement.FindDecorator(shape.Decorators, "SQLGlyph").AssociateVisibilityWith(shape.Store, propertyInfo);

propertyInfo = new DslDiagrams::AssociatedPropertyInfo(global::Sawczyn.EFDesigner.EFModel.ModelClass.GlyphTypeDomainPropertyId);
propertyInfo.FilteringValues.Add("DictionaryGlyph");
DslDiagrams::ShapeElement.FindDecorator(shape.Decorators, "DictionaryGlyph").AssociateVisibilityWith(shape.Store, propertyInfo);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/Dsl/GeneratedCode/Shapes.cs
Expand Up @@ -374,7 +374,7 @@ protected override void InitializeDecorators(global::System.Collections.Generic.
decorators.Add(decorator6);

DslDiagrams::ShapeField field7 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "NoGenGlyph");
DslDiagrams::Decorator decorator7 = new DslDiagrams::ShapeDecorator(field7, DslDiagrams::ShapeDecoratorPosition.InnerTopLeft, DslDiagrams::PointD.Empty);
DslDiagrams::Decorator decorator7 = new DslDiagrams::ShapeDecorator(field7, DslDiagrams::ShapeDecoratorPosition.InnerTopLeft, new DslDiagrams::PointD(0.01, 0));
decorators.Add(decorator7);

DslDiagrams::ShapeField field8 = DslDiagrams::ShapeElement.FindShapeField(shapeFields, "DictionaryGlyph");
Expand Down
13 changes: 0 additions & 13 deletions src/DslPackage/DslPackage.csproj
Expand Up @@ -242,18 +242,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="GeneratedCode\GeneratedVSCT.vsct">
<Generator>VsctGenerator</Generator>
Expand Down Expand Up @@ -405,7 +393,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
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.
11 changes: 8 additions & 3 deletions src/DslPackage/TextTemplates/EFModelGenerator.ttinclude
Expand Up @@ -799,10 +799,15 @@
&& !x.IsCollection
&& !x.ConstructorParameterOnly))
{
if (GetDefaultConstructorVisibility(navigationProperty.ClassType) == "public")
Output($"{navigationProperty.PropertyName} = new {navigationProperty.ClassType.FullName}();");
if (navigationProperty.ClassType.IsAbstract)
Output($"Setter for {navigationProperty.ClassType.Name} {navigationProperty.PropertyName} was not created because it's abstract. This must be set before saving.");
else
Output($"{navigationProperty.PropertyName} = {navigationProperty.ClassType.FullName}.Create{navigationProperty.ClassType.Name}Unsafe();");
{
if (GetDefaultConstructorVisibility(navigationProperty.ClassType) == "public")
Output($"{navigationProperty.PropertyName} = new {navigationProperty.ClassType.FullName}();");
else
Output($"{navigationProperty.PropertyName} = {navigationProperty.ClassType.FullName}.Create{navigationProperty.ClassType.Name}Unsafe();");
}
++lineCount;
}

Expand Down
11 changes: 8 additions & 3 deletions src/DslPackage/TextTemplates/EditingOnly/EFModelGenerator.cs
Expand Up @@ -787,10 +787,15 @@ protected void WriteDefaultConstructorBody(ModelClass modelClass)
&& !x.IsCollection
&& !x.ConstructorParameterOnly))
{
if (GetDefaultConstructorVisibility(navigationProperty.ClassType) == "public")
Output($"{navigationProperty.PropertyName} = new {navigationProperty.ClassType.FullName}();");
if (navigationProperty.ClassType.IsAbstract)
Output($"Setter for {navigationProperty.ClassType.Name} {navigationProperty.PropertyName} was not created because it's abstract. This must be set before saving.");
else
Output($"{navigationProperty.PropertyName} = {navigationProperty.ClassType.FullName}.Create{navigationProperty.ClassType.Name}Unsafe();");
{
if (GetDefaultConstructorVisibility(navigationProperty.ClassType) == "public")
Output($"{navigationProperty.PropertyName} = new {navigationProperty.ClassType.FullName}();");
else
Output($"{navigationProperty.PropertyName} = {navigationProperty.ClassType.FullName}.Create{navigationProperty.ClassType.Name}Unsafe();");
}
++lineCount;
}

Expand Down
22 changes: 18 additions & 4 deletions src/Testing/EFCoreV5/EFCore5NetCore3/Context/AllFeatureModel.cs
Expand Up @@ -4,16 +4,30 @@

using Microsoft.EntityFrameworkCore;

namespace Testing
//namespace Testing
//{
// partial class AllFeatureModel
// {
// public AllFeatureModel() { }

// partial void CustomInit(DbContextOptionsBuilder optionsBuilder)
// {
// optionsBuilder.UseSqlServer(ConnectionString);
// }

// }
//}

namespace EFCore5NetCore3
{
partial class AllFeatureModel
/// <inheritdoc/>
public partial class TestContext
{
public AllFeatureModel() { }
public TestContext() { }

partial void CustomInit(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer(ConnectionString);
}

}
}
Expand Up @@ -5,7 +5,7 @@
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
//
// Produced by Entity Framework Visual Editor v3.0.0.2
// Produced by Entity Framework Visual Editor v3.0.0.3
// Source: https://github.com/msawczyn/EFDesigner
// Visual Studio Marketplace: https://marketplace.visualstudio.com/items?itemName=michaelsawczyn.EFDesigner
// Documentation: https://msawczyn.github.io/EFDesigner/
Expand All @@ -22,60 +22,47 @@
using System.Linq;
using System.Runtime.CompilerServices;

namespace Testing
namespace EFCore5NetCore3
{
public abstract partial class HiddenEntity
public abstract partial class AbstractBase
{
partial void Init();

/// <summary>
/// Default constructor. Protected due to being abstract.
/// </summary>
protected HiddenEntity()
protected AbstractBase()
{
Init();
}

/// <summary>
/// Public constructor with required data
/// </summary>
/// <param name="_detail30"></param>
protected AbstractBase(global::EFCore5NetCore3.Detail3 _detail30)
{
if (_detail30 == null) throw new ArgumentNullException(nameof(_detail30));
_detail30.AbstractBases.Add(this);


Init();
}

/*************************************************************************
* Properties
*************************************************************************/

/// <summary>
/// Backing field for Id
/// </summary>
internal int _id;
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before setting.
/// </summary>
partial void SetId(int oldValue, ref int newValue);
/// <summary>
/// When provided in a partial class, allows value of Id to be changed before returning.
/// </summary>
partial void GetId(ref int result);

/// <summary>
/// Identity, Indexed, Required
/// </summary>
[Key]
[Required]
public int Id
{
get
{
int value = _id;
GetId(ref value);
return (_id = value);
}
protected set
{
int oldValue = _id;
SetId(oldValue, ref value);
if (oldValue != value)
{
_id = value;
}
}
}
public long Id { get; protected set; }

/*************************************************************************
* Navigation properties
*************************************************************************/

}
}
Expand Down

0 comments on commit 4c79950

Please sign in to comment.