Skip to content

Commit 7f3cd4a

Browse files
committed
Module upgrades and tweaks; Modelers.Services.CQRS module
1 parent f93999d commit 7f3cd4a

File tree

84 files changed

+2717
-107
lines changed

Some content is hidden

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

84 files changed

+2717
-107
lines changed

Modules/Intent.ApplicationTemplates/Intent.ApplicationTemplateBuilder/metadata.iatspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<applicationTemplate>
33
<id>Intent.ApplicationTemplateBuilder</id>
4-
<version>1.0.0</version>
4+
<version>1.0.1</version>
55
<supportedClientVersions>[3.0.0-beta,4.0.0)</supportedClientVersions>
66
<displayName>Intent Application Template Builder</displayName>
77
<shortDescription>Build application templates for your tech stack.</shortDescription>

Modules/Intent.ApplicationTemplates/Intent.ApplicationTemplates.application.config

+1-1
Large diffs are not rendered by default.

Modules/Intent.ApplicationTemplates/Intent.Metadata/App Templates/App Templates.designer.config

+1-1
Large diffs are not rendered by default.

Modules/Intent.ApplicationTemplates/Intent.Metadata/App Templates/Intent.ApplicationTemplateBuilder/Elements/Component Group/0338b087-ca36-40c7-a3ef-ff0b58b61682.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<definitionPackageName>Intent.ApplicationTemplate.Builder</definitionPackageName>
5151
<definitionPackageId>002e9a7f-e5b7-4392-a60f-b60ae4e86262</definitionPackageId>
5252
<properties>
53-
<property name="8235e942-6dec-4576-be44-3543b35ca44c" display="Version" value="3.0.0-beta.3" isActive="true" />
53+
<property name="8235e942-6dec-4576-be44-3543b35ca44c" display="Version" value="3.0.0-beta.5" isActive="true" />
5454
</properties>
5555
</stereotype>
5656
</stereotypes>

Modules/Intent.ApplicationTemplates/Intent.Metadata/App Templates/Intent.ApplicationTemplateBuilder/Elements/Component Group/a11ca722-e02d-4b1f-824b-ca86e8fa201e.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<definitionPackageName>Intent.ApplicationTemplate.Builder</definitionPackageName>
5151
<definitionPackageId>002e9a7f-e5b7-4392-a60f-b60ae4e86262</definitionPackageId>
5252
<properties>
53-
<property name="8235e942-6dec-4576-be44-3543b35ca44c" display="Version" value="3.0.0-beta.3" isActive="true" />
53+
<property name="8235e942-6dec-4576-be44-3543b35ca44c" display="Version" value="3.0.0-beta.5" isActive="true" />
5454
</properties>
5555
</stereotype>
5656
</stereotypes>

Modules/Intent.ApplicationTemplates/Intent.Metadata/App Templates/Intent.ApplicationTemplateBuilder/Intent.ApplicationTemplateBuilder.pkg.config

+2-2
Large diffs are not rendered by default.

Modules/Intent.ApplicationTemplates/Intent.ModuleBuilder/content/visual-studio-projects.installation.settings

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<targetDesignerId>0701433c-36c0-4569-b1f4-9204986b587d</targetDesignerId>
44
<createPackages>
55
<package typeId="07e7b690-a59d-4b72-8440-4308a121d32c" type="Visual Studio Solution">
6-
<name>${application.name}</name>
6+
<name>${solution.name}</name>
77
<childElements>
88
<element typeId="52B49DB5-3EA9-4095-B1A7-DF1AC22D7DAE" type="Class Library (.NET Core)">
99
<name>${application.name}</name>
@@ -14,7 +14,7 @@
1414
<definitionPackageId>a0636ab7-d3a1-430b-9609-11a18aa3cc7f</definitionPackageId>
1515
<properties>
1616
<property name="4756bd10-23e2-473b-9957-d7083759cd42" display="Target Multiple Frameworks" value="false" isActive="true" />
17-
<property name="ef3e7b17-ba1d-4818-82a2-5a8ad3875d40" display="Target Framework" value="f2872d65-d69e-460d-988b-165e2fa6c8ca" isActive="true" />
17+
<property name="ef3e7b17-ba1d-4818-82a2-5a8ad3875d40" display="Target Framework" value="2619c225-4a0d-40ba-ae06-6b2c31384342" isActive="true" />
1818
<property name="5215b600-32fc-4a6d-af72-9eb88a6f30e7" display="Target Frameworks" value="" isActive="false" />
1919
</properties>
2020
</stereotype>

Modules/Intent.ApplicationTemplates/Intent.ModuleBuilder/metadata.iatspec

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<applicationTemplate>
33
<id>Intent.ApplicationTemplate.ModuleBuilder</id>
4-
<version>3.0.4</version>
4+
<version>3.0.5</version>
55
<supportedClientVersions>[3.0.0-beta,4.0.0)</supportedClientVersions>
66
<displayName>Intent Module Builder</displayName>
77
<shortDescription>Create an Intent Module to automate patterns &amp; code-structures specific to your project and technologies.</shortDescription>
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<modules>
3-
<module moduleId="Intent.ApplicationTemplate.Builder" version="3.0.0-beta.3" />
4-
<module moduleId="Intent.Common" version="3.0.0-beta.4" />
3+
<module moduleId="Intent.ApplicationTemplate.Builder" version="3.0.0-beta.5" />
4+
<module moduleId="Intent.Common" version="3.0.0-beta.5" />
55
<module moduleId="Intent.Common.CSharp" version="3.0.0-beta.3" />
6-
<module moduleId="Intent.Common.Types" version="3.0.0-beta.3" />
6+
<module moduleId="Intent.Common.Types" version="3.0.0-beta.5" />
77
<module moduleId="Intent.VisualStudio.Projects" version="3.0.0-beta.3" />
88
</modules>

Modules/Intent.Modules.Common.Types/Api/FolderExtensions.cs

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using Intent.Metadata.Models;
34
using Intent.RoslynWeaver.Attributes;
@@ -6,7 +7,7 @@ namespace Intent.Modules.Common.Types.Api
67
{
78
public static class FolderExtensions
89
{
9-
public static IList<FolderModel> GetFolderPath(this IHasFolder model, bool includePackage = false)
10+
public static IList<FolderModel> GetFolderModels(this IHasFolder model)
1011
{
1112
List<FolderModel> result = new List<FolderModel>();
1213

@@ -19,6 +20,13 @@ public static IList<FolderModel> GetFolderPath(this IHasFolder model, bool inclu
1920
return result;
2021
}
2122

23+
[Obsolete("Use GetFolderModels")]
24+
public static IList<FolderModel> GetFolderPath(this IHasFolder model, bool includePackage = false)
25+
{
26+
return GetFolderModels(model);
27+
}
28+
29+
2230
public static IStereotype GetStereotypeInFolders(this IHasFolder model, string stereotypeName)
2331
{
2432
var folder = model.Folder;

Modules/Intent.Modules.Common/Intent.Modules.Common.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<PackageId>Intent.Modules.Common</PackageId>
6-
<Version>3.0.0-pre.5</Version>
6+
<Version>3.0.0-pre.6</Version>
77
<Authors>Intent Architect</Authors>
88
<Product>Intent - Modules Common</Product>
99
<Description>Base classes and helpers for building your own modules for Intent Architect.</Description>

Modules/Intent.Modules.Common/TypeResolution/TypeResolverBase.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public abstract class TypeResolverBase : ITypeResolver
1010
{
1111
private const string DEFAULT_CONTEXT = "_default_";
1212
private readonly IDictionary<string, List<ITypeSource>> _classTypeSources;
13+
private static IList<ITypeSource> _globalTypeSources = new List<ITypeSource>();
1314

1415
protected TypeResolverBase()
1516
{
@@ -50,7 +51,9 @@ public ITypeResolverContext InContext(string contextName)
5051

5152
public IEnumerable<ITemplateDependency> GetTemplateDependencies()
5253
{
53-
return _classTypeSources.Values.SelectMany(x => x).SelectMany(x => x.GetTemplateDependencies()).ToList();
54+
return _classTypeSources.Values
55+
.SelectMany(x => x)
56+
.SelectMany(x => x.GetTemplateDependencies()).ToList();
5457
}
5558

5659
public IResolvedTypeInfo Get(ITypeReference typeInfo)

Modules/Intent.Modules.Modelers.ServiceProxies/Intent.Modules.Modelers.ServiceProxies.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<TargetFramework>netcoreapp2.1</TargetFramework>
55
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
6-
<Version>3.0.0-pre.2</Version>
6+
<Version>3.0.0-pre.3</Version>
77
<Authors>Intent Architect</Authors>
88
<Company>Intent Architect</Company>
99
<Product>Intent - Modules Service Proxy Types</Product>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Intent.Metadata.Models;
5+
using Intent.Modelers.Services.Api;
6+
using Intent.Modules.Common.Types.Api;
7+
using Intent.RoslynWeaver.Attributes;
8+
9+
[assembly: DefaultIntentManaged(Mode.Fully)]
10+
[assembly: IntentTemplate("ModuleBuilder.Templates.Api.ApiElementModel", Version = "1.0")]
11+
12+
namespace Intent.Modelers.Services.CQRS.Api
13+
{
14+
[IntentManaged(Mode.Merge)]
15+
public class CommandModel : IMetadataModel, IHasStereotypes, IHasName, IHasTypeReference, IHasFolder
16+
{
17+
public const string SpecializationType = "Command";
18+
public const string SpecializationTypeId = "ccf14eb6-3a55-4d81-b5b9-d27311c70cb9";
19+
protected readonly IElement _element;
20+
21+
[IntentManaged(Mode.Ignore)]
22+
public CommandModel(IElement element, string requiredType = SpecializationType)
23+
{
24+
if (!requiredType.Equals(element.SpecializationType, StringComparison.InvariantCultureIgnoreCase))
25+
{
26+
throw new Exception($"Cannot create a '{GetType().Name}' from element with specialization type '{element.SpecializationType}'. Must be of type '{SpecializationType}'");
27+
}
28+
_element = element;
29+
Folder = _element.ParentElement?.SpecializationTypeId == FolderModel.SpecializationTypeId ? new FolderModel(_element.ParentElement) : null;
30+
}
31+
32+
public string Id => _element.Id;
33+
34+
public string Name => _element.Name;
35+
36+
public IEnumerable<IStereotype> Stereotypes => _element.Stereotypes;
37+
38+
public FolderModel Folder { get; }
39+
40+
public ITypeReference TypeReference => _element.TypeReference;
41+
42+
public IElement InternalElement => _element;
43+
44+
public string GetConceptName()
45+
{
46+
return Name.EndsWith("Command") ? Name.Substring(0, Name.Length - "Command".Length) : Name;
47+
}
48+
49+
public IList<DTOFieldModel> Properties => _element.ChildElements
50+
.Where(x => x.SpecializationType == DTOFieldModel.SpecializationType)
51+
.Select(x => new DTOFieldModel(x))
52+
.ToList();
53+
54+
public override string ToString()
55+
{
56+
return _element.ToString();
57+
}
58+
59+
public bool Equals(CommandModel other)
60+
{
61+
return Equals(_element, other?._element);
62+
}
63+
64+
public override bool Equals(object obj)
65+
{
66+
if (ReferenceEquals(null, obj)) return false;
67+
if (ReferenceEquals(this, obj)) return true;
68+
if (obj.GetType() != this.GetType()) return false;
69+
return Equals((CommandModel)obj);
70+
}
71+
72+
public override int GetHashCode()
73+
{
74+
return (_element != null ? _element.GetHashCode() : 0);
75+
}
76+
}
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Intent.Metadata.Models;
5+
using Intent.Modules.Common.Types.Api;
6+
using Intent.RoslynWeaver.Attributes;
7+
8+
[assembly: DefaultIntentManaged(Mode.Fully)]
9+
[assembly: IntentTemplate("ModuleBuilder.Templates.Api.ApiElementExtensionModel", Version = "1.0")]
10+
11+
namespace Intent.Modelers.Services.CQRS.Api
12+
{
13+
[IntentManaged(Mode.Merge)]
14+
public class FolderExtensionModel : FolderModel
15+
{
16+
[IntentManaged(Mode.Ignore)]
17+
public FolderExtensionModel(IElement element) : base(element)
18+
{
19+
}
20+
21+
public IList<CommandModel> Commands => _element.ChildElements
22+
.Where(x => x.SpecializationType == CommandModel.SpecializationType)
23+
.Select(x => new CommandModel(x))
24+
.ToList();
25+
26+
public IList<QueryModel> Queries => _element.ChildElements
27+
.Where(x => x.SpecializationType == QueryModel.SpecializationType)
28+
.Select(x => new QueryModel(x))
29+
.ToList();
30+
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Intent.Metadata.Models;
5+
using Intent.Modelers.Services.Api;
6+
using Intent.RoslynWeaver.Attributes;
7+
8+
[assembly: DefaultIntentManaged(Mode.Fully)]
9+
[assembly: IntentTemplate("ModuleBuilder.Templates.Api.ApiElementExtensionModel", Version = "1.0")]
10+
11+
namespace Intent.Modelers.Services.CQRS.Api
12+
{
13+
[IntentManaged(Mode.Merge)]
14+
public class OperationExtensionModel : OperationModel
15+
{
16+
[IntentManaged(Mode.Ignore)]
17+
public OperationExtensionModel(IElement element) : base(element)
18+
{
19+
}
20+
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Intent.Metadata.Models;
5+
using Intent.Modelers.Services.Api;
6+
using Intent.RoslynWeaver.Attributes;
7+
8+
[assembly: DefaultIntentManaged(Mode.Fully)]
9+
[assembly: IntentTemplate("ModuleBuilder.Templates.Api.ApiElementExtensionModel", Version = "1.0")]
10+
11+
namespace Intent.Modelers.Services.CQRS.Api
12+
{
13+
[IntentManaged(Mode.Merge)]
14+
public class ParameterExtensionModel : ParameterModel
15+
{
16+
[IntentManaged(Mode.Ignore)]
17+
public ParameterExtensionModel(IElement element) : base(element)
18+
{
19+
}
20+
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Intent.Metadata.Models;
5+
using Intent.Modelers.Services.Api;
6+
using Intent.Modules.Common.Types.Api;
7+
using Intent.RoslynWeaver.Attributes;
8+
9+
[assembly: DefaultIntentManaged(Mode.Fully)]
10+
[assembly: IntentTemplate("ModuleBuilder.Templates.Api.ApiElementModel", Version = "1.0")]
11+
12+
namespace Intent.Modelers.Services.CQRS.Api
13+
{
14+
[IntentManaged(Mode.Merge)]
15+
public class QueryModel : IMetadataModel, IHasStereotypes, IHasName, IHasTypeReference, IHasFolder
16+
{
17+
public const string SpecializationType = "Query";
18+
public const string SpecializationTypeId = "e71b0662-e29d-4db2-868b-8a12464b25d0";
19+
protected readonly IElement _element;
20+
21+
[IntentManaged(Mode.Ignore)]
22+
public QueryModel(IElement element, string requiredType = SpecializationType)
23+
{
24+
if (!requiredType.Equals(element.SpecializationType, StringComparison.InvariantCultureIgnoreCase))
25+
{
26+
throw new Exception($"Cannot create a '{GetType().Name}' from element with specialization type '{element.SpecializationType}'. Must be of type '{SpecializationType}'");
27+
}
28+
_element = element;
29+
Folder = _element.ParentElement?.SpecializationTypeId == FolderModel.SpecializationTypeId ? new FolderModel(_element.ParentElement) : null;
30+
}
31+
32+
public string Id => _element.Id;
33+
34+
public string Name => _element.Name;
35+
36+
public IEnumerable<IStereotype> Stereotypes => _element.Stereotypes;
37+
38+
public FolderModel Folder { get; }
39+
40+
public ITypeReference TypeReference => _element.TypeReference;
41+
42+
public IElement InternalElement => _element;
43+
44+
public string GetConceptName()
45+
{
46+
return Name.EndsWith("Query") ? Name.Substring(0, Name.Length - "Query".Length) : Name;
47+
}
48+
49+
public IList<DTOFieldModel> Properties => _element.ChildElements
50+
.Where(x => x.SpecializationType == DTOFieldModel.SpecializationType)
51+
.Select(x => new DTOFieldModel(x))
52+
.ToList();
53+
54+
public override string ToString()
55+
{
56+
return _element.ToString();
57+
}
58+
59+
public bool Equals(QueryModel other)
60+
{
61+
return Equals(_element, other?._element);
62+
}
63+
64+
public override bool Equals(object obj)
65+
{
66+
if (ReferenceEquals(null, obj)) return false;
67+
if (ReferenceEquals(this, obj)) return true;
68+
if (obj.GetType() != this.GetType()) return false;
69+
return Equals((QueryModel)obj);
70+
}
71+
72+
public override int GetHashCode()
73+
{
74+
return (_element != null ? _element.GetHashCode() : 0);
75+
}
76+
}
77+
}

0 commit comments

Comments
 (0)