Skip to content

Commit

Permalink
v4.2.8 rc2
Browse files Browse the repository at this point in the history
  • Loading branch information
msawczyn committed Feb 1, 2024
1 parent 2a31fda commit 0964e7a
Show file tree
Hide file tree
Showing 21 changed files with 397 additions and 508 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ If you're interested in helping out, **please** drop a note at the GitHub projec
More hands make the work lighter, and I know there are some really bright people amongst the userbase who are much better at writing documentation than I am.

### Change Log
4.2.8
- Better handling of N-N relations in assembly parser
- Better detection of principal/dependent roles in assembly parser
- Removed "dbo" as default schema in design surface properties. Not specifying will allow the database to use whatever default schema is appropriate for it.
- Corrected some deficits in how column name overrides were being handled in EFCore

[4.2.7](https://github.com/msawczyn/EFDesigner2022/releases/download/v4.2.7/Sawczyn.EFDesigner.EFModel.DslPackage.vsix)
- Support for per-entity inheritance in EF7
- Added option to generate nullable indicators
Expand Down
6 changes: 6 additions & 0 deletions VSMarketplace blurb.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ More hands make the work lighter, and I know there are some really bright people

**ChangeLog**

**4.2.8**
- Better handling of N-N relations in assembly parser
- Better detection of principal/dependent roles in assembly parser
- Removed "dbo" as default schema in design surface properties. Not specifying will allow the database to use whatever default schema is appropriate for it.
- Corrected some deficits in how column name overrides were being handled in EFCore

**4.2.7**
- **[NEW]** Support for per-entity inheritance in EF7
- **[NEW]** Added option to generate nullable indicators
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
- Better handling of N-N relations in assembly parser
- Better detection of principal/dependent roles in assembly parser
- Removed "dbo" as default schema in design surface properties. Not specifying will allow the database to use whatever default schema is appropriate for it.
- Corrected some deficits in how column name overrides were being handled in EFCore

4.2.7
- Support for per-entity inheritance in EF7
Expand Down
4 changes: 2 additions & 2 deletions dist/Sawczyn.EFDesigner.EFModel.DslPackage.vsix
Git LFS file not shown
7 changes: 6 additions & 1 deletion src/Dsl/CustomCode/Partials/Association.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,12 @@ internal IEnumerable<ModelAttribute> GetFKAutoIdentityErrors()
/// </summary>
public string[] GetForeignKeyPropertyNames()
{
return FKPropertyName?.Split(',').Select(n => n.Trim()).ToArray() ?? Array.Empty<string>();
if (!string.IsNullOrEmpty(FKPropertyName))
return FKPropertyName?.Split(',').Select(n => n.Trim()).ToArray() ?? Array.Empty<string>();

string[] fkProperties = Source.ModelRoot.Store.GetAll<ModelAttribute>().Where(a => a.IsForeignKeyFor == Id).Select(a => a.Name).ToArray();

return fkProperties;
}

private string GetNameValue()
Expand Down
23 changes: 14 additions & 9 deletions src/Dsl/CustomCode/Type Descriptors/AssociationTypeDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,13 @@ private PropertyDescriptorCollection GetCustomProperties(Attribute[] attributes)
propertyDescriptors.Remove("IsJSON");
}

// don't display roles for N..N, 1..N or 0-1..N associations
// don't display roles for X..N associations
if (association.SourceMultiplicity == Multiplicity.ZeroMany || association.TargetMultiplicity == Multiplicity.ZeroMany)
{
propertyDescriptors.Remove("SourceRole");
propertyDescriptors.Remove("TargetRole");
}

if (association.SourceMultiplicity != Multiplicity.ZeroMany || association.TargetMultiplicity != Multiplicity.ZeroMany)
{
propertyDescriptors.Remove("SourceRole");
propertyDescriptors.Remove("TargetRole");
}

// only display delete behavior on the principal end
// except that owned types don't have deletion behavior choices
if (association.SourceRole != EndpointRole.Principal || association.Source.IsDependentType || association.Target.IsDependentType)
Expand All @@ -85,8 +79,19 @@ private PropertyDescriptorCollection GetCustomProperties(Attribute[] attributes)
if (association.TargetRole != EndpointRole.Principal || association.Source.IsDependentType || association.Target.IsDependentType)
propertyDescriptors.Remove("TargetDeleteAction");

// only show join table details if is *..* association and no association class
if ((!isManyToMany || !modelRoot.IsEFCore5Plus) && association.GetAssociationClass() != null)
if (association.Source.IsDependentType || association.Target.IsDependentType)
{
propertyDescriptors.Remove("SourceFKColumnName");
propertyDescriptors.Remove("TargetFKColumnName");
}

if (!isManyToMany/* || association.GetAssociationClass() != null*/)
{
propertyDescriptors.Remove("JoinTableName");
propertyDescriptors.Remove("SourceFKColumnName");
}

if (!modelRoot.IsEFCore5Plus)
{
propertyDescriptors.Remove("JoinTableName");
propertyDescriptors.Remove("SourceFKColumnName");
Expand Down
8 changes: 4 additions & 4 deletions src/Dsl/CustomCode/Utilities/Import/AssemblyProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ private void ProcessUnidirectionalAssociations(ParsingModels.ModelClass modelCla
if (string.IsNullOrWhiteSpace(existing.FKPropertyName) && !string.IsNullOrWhiteSpace(data.ForeignKey))
{
existing.FKPropertyName = data.ForeignKey;
existing.FKColumnName = data.ForeignKeyColumnName;
existing.TargetFKColumnName = data.ForeignKeyColumnName;
existing.Source.ModelRoot.ExposeForeignKeys = true;
}

Expand All @@ -516,7 +516,7 @@ private void ProcessUnidirectionalAssociations(ParsingModels.ModelClass modelCla
elementLink.TargetSummary = data.TargetSummary;
elementLink.TargetDescription = data.TargetDescription;
elementLink.FKPropertyName = data.ForeignKey;
elementLink.FKColumnName = data.ForeignKeyColumnName;
elementLink.TargetFKColumnName = data.ForeignKeyColumnName;
elementLink.SourceRole = ConvertRole(data.SourceRole);
elementLink.TargetRole = ConvertRole(data.TargetRole);

Expand Down Expand Up @@ -576,7 +576,7 @@ private void ProcessBidirectionalAssociations(ParsingModels.ModelClass modelClas
if (string.IsNullOrWhiteSpace(existing.FKPropertyName) && !string.IsNullOrWhiteSpace(data.ForeignKey))
{
existing.FKPropertyName = string.Join(",", data.ForeignKey.Split(',').ToList().Select(p => p.Split('/').Last().Split(' ').Last()));
existing.FKColumnName = data.ForeignKeyColumnName;
existing.TargetFKColumnName = data.ForeignKeyColumnName;
existing.Source.ModelRoot.ExposeForeignKeys = true;
}

Expand All @@ -596,7 +596,7 @@ private void ProcessBidirectionalAssociations(ParsingModels.ModelClass modelClas
elementLink.TargetSummary = data.TargetSummary;
elementLink.TargetDescription = data.TargetDescription;
elementLink.FKPropertyName = data.ForeignKey;
elementLink.FKColumnName = data.ForeignKeyColumnName;
elementLink.TargetFKColumnName = data.ForeignKeyColumnName;
elementLink.SourceRole = ConvertRole(data.SourceRole);
elementLink.TargetRole = ConvertRole(data.TargetRole);
elementLink.SourcePropertyName = data.SourcePropertyName;
Expand Down
4 changes: 2 additions & 2 deletions src/Dsl/DslDefinition.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@
<ExternalTypeMoniker Name="/System/Boolean" />
</Type>
</DomainProperty>
<DomainProperty Id="33c1f80e-1661-4666-9112-918463abc4ec" Description="Optional name of column holding foreign key value for this end of the association" Name="TargetFKColumnName" DisplayName="Foreign Key Column Name" Category="End 2">
<DomainProperty Id="33c1f80e-1661-4666-9112-918463abc4ec" Description="Optional name of column holding foreign key value for this end of the association" Name="TargetFKColumnName" DisplayName="End2 Foreign Key Column Name" Category="End 2">
<Type>
<ExternalTypeMoniker Name="/System/String" />
</Type>
Expand Down Expand Up @@ -1571,7 +1571,7 @@
<ExternalTypeMoniker Name="/System/String" />
</Type>
</DomainProperty>
<DomainProperty Id="44fda399-d8f1-4d63-80f1-881277cb8115" Description="Should this end participate in INotifyPropertyChanged activities? Only valid for non-collection targets." Name="SourceImplementNotify" DisplayName="Implement INotifyPropertyChanged" Kind="CustomStorage" Category="End 1" IsBrowsable="false">
<DomainProperty Id="44fda399-d8f1-4d63-80f1-881277cb8115" Description="Should this end participate in INotifyPropertyChanged activities? Only valid for non-collection targets." Name="SourceImplementNotify" DisplayName="End1 Implement INotifyPropertyChanged" Kind="CustomStorage" Category="End 1" IsBrowsable="false">
<Type>
<ExternalTypeMoniker Name="/System/Boolean" />
</Type>
Expand Down
Loading

0 comments on commit 0964e7a

Please sign in to comment.