Skip to content

Commit c8d1f59

Browse files
authored
Merge pull request #76 from delegateas/patches/121287-more-patches
Refactoring into smaller services, more Insights and more Processes
2 parents 8d9f80d + 02bc756 commit c8d1f59

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+3659
-2204
lines changed

DataModelViewer.sln

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 17
4-
VisualStudioVersion = 17.14.36429.23 d17.14
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.3.11222.16
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Generator", "Generator\Generator.csproj", "{164968FD-4D5C-4C5F-BAE2-EBC071F2AB7D}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Generator.Tests", "Generator.Tests\Generator.Tests.csproj", "{DD894991-9A5E-4201-9651-C7367BE8FA34}"
99
EndProject
10-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{02EA681E-C7D8-13C7-8484-4AC65E1B71E8}"
11-
EndProject
12-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{E2A0671D-5354-45C7-8D86-287DBCA099EC}"
13-
EndProject
14-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AddWebResourceDescription", "Tools\Scripts\AddWebResourceDescription.csproj", "{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2}"
15-
EndProject
16-
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "SharedTools", "SharedTools\SharedTools.shproj", "{668737CF-1205-43E7-9CE2-1E451FD8C8A7}"
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9EFE4F19-B072-4920-985D-1489373F5E1B}"
11+
ProjectSection(SolutionItems) = preProject
12+
Tools\Scripts\addWebResourceDescription.cs = Tools\Scripts\addWebResourceDescription.cs
13+
EndProjectSection
1714
EndProject
1815
Global
1916
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -29,23 +26,11 @@ Global
2926
{DD894991-9A5E-4201-9651-C7367BE8FA34}.Debug|Any CPU.Build.0 = Debug|Any CPU
3027
{DD894991-9A5E-4201-9651-C7367BE8FA34}.Release|Any CPU.ActiveCfg = Release|Any CPU
3128
{DD894991-9A5E-4201-9651-C7367BE8FA34}.Release|Any CPU.Build.0 = Release|Any CPU
32-
{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33-
{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
34-
{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
35-
{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2}.Release|Any CPU.Build.0 = Release|Any CPU
3629
EndGlobalSection
3730
GlobalSection(SolutionProperties) = preSolution
3831
HideSolutionNode = FALSE
3932
EndGlobalSection
40-
GlobalSection(NestedProjects) = preSolution
41-
{02EA681E-C7D8-13C7-8484-4AC65E1B71E8} = {E2A0671D-5354-45C7-8D86-287DBCA099EC}
42-
{379C35FE-EAD1-E476-6E2C-58C14BFEF2B2} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
43-
{668737CF-1205-43E7-9CE2-1E451FD8C8A7} = {02EA681E-C7D8-13C7-8484-4AC65E1B71E8}
44-
EndGlobalSection
4533
GlobalSection(ExtensibilityGlobals) = postSolution
4634
SolutionGuid = {53B88BBA-AEED-4925-9F3A-E96F7B0E00C5}
4735
EndGlobalSection
48-
GlobalSection(SharedMSBuildProjectFiles) = preSolution
49-
SharedTools\SharedTools.projitems*{668737cf-1205-43e7-9ce2-1e451fd8c8a7}*SharedItemsImports = 13
50-
EndGlobalSection
5136
EndGlobal

Generator/DTO/AttributeUsage.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ public enum ComponentType
66
Plugin,
77
WebResource,
88
WorkflowActivity,
9-
CustomApi
9+
CustomApi,
10+
BusinessRule,
11+
ClassicWorkflow
1012
}
1113

1214
public enum OperationType
@@ -23,5 +25,6 @@ public record AttributeUsage(
2325
string Name,
2426
string Usage,
2527
OperationType OperationType,
26-
ComponentType ComponentType
28+
ComponentType ComponentType,
29+
bool IsFromDependencyAnalysis
2730
);

Generator/DTO/Attributes/Attribute.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Xrm.Sdk.Metadata;
1+
using Generator.Extensions;
2+
using Microsoft.Xrm.Sdk.Metadata;
23

34
namespace Generator.DTO.Attributes;
45

@@ -9,6 +10,10 @@ public abstract class Attribute
910
public bool IsPrimaryId { get; set; }
1011
public bool IsPrimaryName { get; set; }
1112
public List<AttributeUsage> AttributeUsages { get; set; } = new List<AttributeUsage>();
13+
public bool IsExplicit { get; set; }
14+
public string PublisherName { get; set; }
15+
public string PublisherPrefix { get; set; }
16+
public List<SolutionInfo> Solutions { get; set; } = new List<SolutionInfo>();
1217
public string DisplayName { get; }
1318
public string SchemaName { get; }
1419
public string Description { get; }
@@ -23,9 +28,9 @@ protected Attribute(AttributeMetadata metadata)
2328
IsPrimaryId = metadata.IsPrimaryId ?? false;
2429
IsPrimaryName = metadata.IsPrimaryName ?? false;
2530
IsCustomAttribute = metadata.IsCustomAttribute ?? false;
26-
DisplayName = metadata.DisplayName.UserLocalizedLabel?.Label ?? string.Empty;
31+
DisplayName = metadata.DisplayName.ToLabelString();
2732
SchemaName = metadata.SchemaName;
28-
Description = metadata.Description.UserLocalizedLabel?.Label.PrettyDescription() ?? string.Empty;
33+
Description = metadata.Description.ToLabelString().PrettyDescription() ?? string.Empty;
2934
RequiredLevel = metadata.RequiredLevel.Value;
3035
IsAuditEnabled = metadata.IsAuditEnabled.Value;
3136
IsColumnSecured = metadata.IsSecured ?? false;

Generator/DTO/Attributes/BooleanAttribute.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Xrm.Sdk.Metadata;
1+
using Generator.Extensions;
2+
using Microsoft.Xrm.Sdk.Metadata;
23

34
namespace Generator.DTO.Attributes;
45

@@ -11,8 +12,8 @@ internal class BooleanAttribute : Attribute
1112
public BooleanAttribute(BooleanAttributeMetadata metadata)
1213
: base(metadata)
1314
{
14-
TrueLabel = metadata.OptionSet.TrueOption.Label.UserLocalizedLabel?.Label ?? string.Empty;
15-
FalseLabel = metadata.OptionSet.FalseOption.Label.UserLocalizedLabel?.Label ?? string.Empty;
15+
TrueLabel = metadata.OptionSet.TrueOption.Label.ToLabelString();
16+
FalseLabel = metadata.OptionSet.FalseOption.Label.ToLabelString();
1617
DefaultValue = metadata.DefaultValue;
1718
}
1819
}

Generator/DTO/Attributes/ChoiceAttribute.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using Microsoft.Xrm.Sdk.Metadata;
1+
using Generator.Extensions;
2+
using Microsoft.Xrm.Sdk.Metadata;
23

34
namespace Generator.DTO.Attributes;
45

@@ -13,32 +14,32 @@ public class ChoiceAttribute : Attribute
1314
public ChoiceAttribute(PicklistAttributeMetadata metadata) : base(metadata)
1415
{
1516
Options = metadata.OptionSet.Options.Select(x => new Option(
16-
x.Label.UserLocalizedLabel?.Label ?? string.Empty,
17+
x.Label.ToLabelString(),
1718
x.Value,
1819
x.Color,
19-
x.Description.UserLocalizedLabel?.Label.PrettyDescription() ?? string.Empty));
20+
x.Description.ToLabelString().PrettyDescription()));
2021
Type = "Single";
2122
DefaultValue = metadata.DefaultFormValue;
2223
}
2324

2425
public ChoiceAttribute(StateAttributeMetadata metadata) : base(metadata)
2526
{
2627
Options = metadata.OptionSet.Options.Select(x => new Option(
27-
x.Label.UserLocalizedLabel?.Label ?? string.Empty,
28+
x.Label.ToLabelString(),
2829
x.Value,
2930
x.Color,
30-
x.Description.UserLocalizedLabel?.Label.PrettyDescription() ?? string.Empty));
31+
x.Description.ToLabelString().PrettyDescription()));
3132
Type = "Single";
3233
DefaultValue = metadata.DefaultFormValue;
3334
}
3435

3536
public ChoiceAttribute(MultiSelectPicklistAttributeMetadata metadata) : base(metadata)
3637
{
3738
Options = metadata.OptionSet.Options.Select(x => new Option(
38-
x.Label.UserLocalizedLabel?.Label ?? string.Empty,
39+
x.Label.ToLabelString(),
3940
x.Value,
4041
x.Color,
41-
x.Description.UserLocalizedLabel?.Label.PrettyDescription() ?? string.Empty));
42+
x.Description.ToLabelString().PrettyDescription()));
4243
Type = "Multi";
4344
DefaultValue = metadata.DefaultFormValue;
4445
}

Generator/DTO/Attributes/LookupAttribute.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@ internal class LookupAttribute : Attribute
1313
{
1414
public IEnumerable<ExtendedEntityInformation> Targets { get; }
1515

16-
public LookupAttribute(LookupAttributeMetadata metadata, Dictionary<string, ExtendedEntityInformation> logicalToSchema, ILogger<DataverseService> logger)
16+
public LookupAttribute(LookupAttributeMetadata metadata, Dictionary<string, ExtendedEntityInformation> logicalToSchema, ILogger? logger = null)
1717
: base(metadata)
1818
{
19-
foreach (var target in metadata.Targets) { if (!logicalToSchema.ContainsKey(target)) logger.LogError($"Missing logicalname in logicalToSchema {target}, on entity {metadata.EntityLogicalName}."); }
19+
if (logger != null)
20+
{
21+
foreach (var target in metadata.Targets)
22+
{
23+
if (!logicalToSchema.ContainsKey(target))
24+
logger.LogError($"Missing logicalname in logicalToSchema {target}, on entity {metadata.EntityLogicalName}.");
25+
}
26+
}
2027

2128
Targets =
2229
metadata.Targets

Generator/DTO/Attributes/StatusAttribute.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Microsoft.Xrm.Sdk.Metadata;
2-
using Newtonsoft.Json;
1+
using Generator.Extensions;
2+
using Microsoft.Xrm.Sdk.Metadata;
33

44
namespace Generator.DTO.Attributes;
55

@@ -13,12 +13,12 @@ public StatusAttribute(StatusAttributeMetadata metadata, StateAttributeMetadata
1313
var stateToName =
1414
stateAttribute.OptionSet.Options
1515
.Where(x => x.Value != null)
16-
.ToDictionary(x => x.Value!.Value, x => x.Label.UserLocalizedLabel?.Label ?? string.Empty);
16+
.ToDictionary(x => x.Value!.Value, x => x.Label.ToLabelString());
1717

1818
Options = metadata.OptionSet.Options
1919
.Select(x => (StatusOptionMetadata)x)
2020
.Select(x => new StatusOption(
21-
x.Label.UserLocalizedLabel?.Label ?? string.Empty,
21+
x.Label.ToLabelString(),
2222
x.Value,
2323
x.State == null ? "Unknown State" : stateToName[x.State.Value]));
2424
}

Generator/DTO/Record.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ internal record Record(
1111
bool IsAuditEnabled,
1212
bool IsActivity,
1313
bool IsCustom,
14+
string PublisherName,
15+
string PublisherPrefix,
1416
OwnershipTypes Ownership,
1517
bool IsNotesEnabled,
1618
List<Attribute> Attributes,
1719
List<Relationship> Relationships,
1820
List<SecurityRole> SecurityRoles,
1921
List<Key> Keys,
20-
string? IconBase64);
22+
string? IconBase64,
23+
List<SolutionInfo> Solutions);
2124

Generator/DTO/Relationship.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,9 @@ public record Relationship(
99
string TableSchema,
1010
string LookupDisplayName,
1111
string RelationshipSchema,
12-
bool IsManyToMany,
13-
CascadeConfiguration? CascadeConfiguration);
12+
string RelationshipType,
13+
bool IsExplicit,
14+
string PublisherName,
15+
string PublisherPrefix,
16+
CascadeConfiguration? CascadeConfiguration,
17+
List<SolutionInfo> Solutions);

Generator/DTO/SolutionInfo.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
namespace Generator.DTO;
2+
3+
/// <summary>
4+
/// Represents solution membership information for a component (entity, attribute, or relationship)
5+
/// </summary>
6+
public record SolutionInfo(
7+
Guid Id,
8+
string Name);

0 commit comments

Comments
 (0)