Skip to content

Commit 335b91d

Browse files
author
Danny Logsdon
committed
Pre-release of v1.1.0 alpha BREAKING CHANGES
Code cleanup, commenting, bug fixes, removal of files
1 parent ebf2ba6 commit 335b91d

File tree

147 files changed

+1053
-1250
lines changed

Some content is hidden

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

147 files changed

+1053
-1250
lines changed

ServiceBricksCacheV1.sln

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,19 +116,16 @@ Global
116116
EndGlobalSection
117117
GlobalSection(ProjectConfigurationPlatforms) = postSolution
118118
{FFA1720D-0707-47B3-A535-AA12A4D413A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
119-
{FFA1720D-0707-47B3-A535-AA12A4D413A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
120119
{FFA1720D-0707-47B3-A535-AA12A4D413A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
121120
{FFA1720D-0707-47B3-A535-AA12A4D413A6}.Release|Any CPU.Build.0 = Release|Any CPU
122121
{190B8CFE-98EE-40B8-9919-4A6B2E83B15C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
123-
{190B8CFE-98EE-40B8-9919-4A6B2E83B15C}.Debug|Any CPU.Build.0 = Debug|Any CPU
124122
{190B8CFE-98EE-40B8-9919-4A6B2E83B15C}.Release|Any CPU.ActiveCfg = Release|Any CPU
125123
{190B8CFE-98EE-40B8-9919-4A6B2E83B15C}.Release|Any CPU.Build.0 = Release|Any CPU
126124
{AD7321F4-AB0C-47CB-9E9A-A556780CFBD9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
127125
{AD7321F4-AB0C-47CB-9E9A-A556780CFBD9}.Debug|Any CPU.Build.0 = Debug|Any CPU
128126
{AD7321F4-AB0C-47CB-9E9A-A556780CFBD9}.Release|Any CPU.ActiveCfg = Release|Any CPU
129127
{AD7321F4-AB0C-47CB-9E9A-A556780CFBD9}.Release|Any CPU.Build.0 = Release|Any CPU
130128
{CDD5F5A1-134F-4874-98C7-C399493B23AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
131-
{CDD5F5A1-134F-4874-98C7-C399493B23AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
132129
{CDD5F5A1-134F-4874-98C7-C399493B23AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
133130
{CDD5F5A1-134F-4874-98C7-C399493B23AC}.Release|Any CPU.Build.0 = Release|Any CPU
134131
{0459D418-D923-4B3B-BF01-6689B9DA7D3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
@@ -140,47 +137,41 @@ Global
140137
{9DE4AEF3-3C9D-47A3-941E-B5B69425E64F}.Release|Any CPU.ActiveCfg = Release|Any CPU
141138
{9DE4AEF3-3C9D-47A3-941E-B5B69425E64F}.Release|Any CPU.Build.0 = Release|Any CPU
142139
{E0AD3F1C-AE5D-4687-B4E5-A6376A28B41F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
143-
{E0AD3F1C-AE5D-4687-B4E5-A6376A28B41F}.Debug|Any CPU.Build.0 = Debug|Any CPU
144140
{E0AD3F1C-AE5D-4687-B4E5-A6376A28B41F}.Release|Any CPU.ActiveCfg = Release|Any CPU
145141
{E0AD3F1C-AE5D-4687-B4E5-A6376A28B41F}.Release|Any CPU.Build.0 = Release|Any CPU
146142
{56988C4A-CB96-4398-B76A-DE9F1085353C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
147143
{56988C4A-CB96-4398-B76A-DE9F1085353C}.Debug|Any CPU.Build.0 = Debug|Any CPU
148144
{56988C4A-CB96-4398-B76A-DE9F1085353C}.Release|Any CPU.ActiveCfg = Release|Any CPU
149145
{56988C4A-CB96-4398-B76A-DE9F1085353C}.Release|Any CPU.Build.0 = Release|Any CPU
150146
{0A032801-0A8B-4210-AE52-5D07658F6900}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
151-
{0A032801-0A8B-4210-AE52-5D07658F6900}.Debug|Any CPU.Build.0 = Debug|Any CPU
152147
{0A032801-0A8B-4210-AE52-5D07658F6900}.Release|Any CPU.ActiveCfg = Release|Any CPU
153148
{0A032801-0A8B-4210-AE52-5D07658F6900}.Release|Any CPU.Build.0 = Release|Any CPU
154149
{EDEF6140-2530-47E6-96D0-8C2C420CDF58}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
155150
{EDEF6140-2530-47E6-96D0-8C2C420CDF58}.Debug|Any CPU.Build.0 = Debug|Any CPU
156151
{EDEF6140-2530-47E6-96D0-8C2C420CDF58}.Release|Any CPU.ActiveCfg = Release|Any CPU
157152
{EDEF6140-2530-47E6-96D0-8C2C420CDF58}.Release|Any CPU.Build.0 = Release|Any CPU
158153
{B2CFD2FE-E39A-4B74-A8EB-89B2359A56BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
159-
{B2CFD2FE-E39A-4B74-A8EB-89B2359A56BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
160154
{B2CFD2FE-E39A-4B74-A8EB-89B2359A56BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
161155
{B2CFD2FE-E39A-4B74-A8EB-89B2359A56BD}.Release|Any CPU.Build.0 = Release|Any CPU
162156
{75B3D74D-8BC9-4B37-B4D6-C2AAA44BE340}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
163157
{75B3D74D-8BC9-4B37-B4D6-C2AAA44BE340}.Debug|Any CPU.Build.0 = Debug|Any CPU
164158
{75B3D74D-8BC9-4B37-B4D6-C2AAA44BE340}.Release|Any CPU.ActiveCfg = Release|Any CPU
165159
{75B3D74D-8BC9-4B37-B4D6-C2AAA44BE340}.Release|Any CPU.Build.0 = Release|Any CPU
166160
{A75D07B8-214B-40AB-8423-9E78272B90B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
167-
{A75D07B8-214B-40AB-8423-9E78272B90B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
168161
{A75D07B8-214B-40AB-8423-9E78272B90B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
169162
{A75D07B8-214B-40AB-8423-9E78272B90B2}.Release|Any CPU.Build.0 = Release|Any CPU
170163
{E75C07EA-3645-4936-9D80-11EC1E2CAA14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
171164
{E75C07EA-3645-4936-9D80-11EC1E2CAA14}.Debug|Any CPU.Build.0 = Debug|Any CPU
172165
{E75C07EA-3645-4936-9D80-11EC1E2CAA14}.Release|Any CPU.ActiveCfg = Release|Any CPU
173166
{E75C07EA-3645-4936-9D80-11EC1E2CAA14}.Release|Any CPU.Build.0 = Release|Any CPU
174167
{C83894ED-21A5-49CA-9D4E-704759BCA530}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
175-
{C83894ED-21A5-49CA-9D4E-704759BCA530}.Debug|Any CPU.Build.0 = Debug|Any CPU
176168
{C83894ED-21A5-49CA-9D4E-704759BCA530}.Release|Any CPU.ActiveCfg = Release|Any CPU
177169
{C83894ED-21A5-49CA-9D4E-704759BCA530}.Release|Any CPU.Build.0 = Release|Any CPU
178170
{E4B5A718-12DA-49DD-8FC1-20A0EDDFCF42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
179171
{E4B5A718-12DA-49DD-8FC1-20A0EDDFCF42}.Debug|Any CPU.Build.0 = Debug|Any CPU
180172
{E4B5A718-12DA-49DD-8FC1-20A0EDDFCF42}.Release|Any CPU.ActiveCfg = Release|Any CPU
181173
{E4B5A718-12DA-49DD-8FC1-20A0EDDFCF42}.Release|Any CPU.Build.0 = Release|Any CPU
182174
{72CDDF80-7850-458F-8AFF-E38FE1993D3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
183-
{72CDDF80-7850-458F-8AFF-E38FE1993D3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
184175
{72CDDF80-7850-458F-8AFF-E38FE1993D3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
185176
{72CDDF80-7850-458F-8AFF-E38FE1993D3B}.Release|Any CPU.Build.0 = Release|Any CPU
186177
{AAAE668B-CE97-489C-A469-0B6C86FC62ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU

src/V1/ServiceBricks.Cache.AzureDataTables.Debug/ServiceBricks.Cache.AzureDataTables.Debug.csproj

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<Version>1.0.8</Version>
5-
<Description>ServiceBricks is the cornerstone for building a microservices foundation. Visit http://ServiceBricks.com to learn more.</Description>
6-
<AssemblyTitle>ServiceBricks.Cache.AzureDataTables</AssemblyTitle>
7-
<Authors>holomodular</Authors>
84
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
95
<Nullable>disable</Nullable>
10-
<Copyright>Copyright © 2023 HoloModular LLC. All Rights Reserved. Visit http://HoloModular.com to learn more.</Copyright>
11-
<PackageProjectUrl>http://ServiceBricks.com</PackageProjectUrl>
12-
<PackageIcon>logo.png</PackageIcon>
13-
<PackageTags>service;bricks;cache;azure;azuredatatables</PackageTags>
14-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
15-
<SignAssembly>True</SignAssembly>
16-
<AssemblyOriginatorKeyFile>ServiceBricks.Cache.AzureDataTables.snk</AssemblyOriginatorKeyFile>
17-
<PackageReadmeFile>readme.md</PackageReadmeFile>
186
<ImplicitUsings>enable</ImplicitUsings>
19-
<PackageRequireLicenseAcceptance>False</PackageRequireLicenseAcceptance>
20-
<RepositoryType>git</RepositoryType>
21-
<RepositoryUrl>https://github.com/holomodular/ServiceBricks</RepositoryUrl>
22-
<IsPackable>False</IsPackable>
237
</PropertyGroup>
248

259
<ItemGroup>
Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
using Azure;
2-
using Azure.Data.Tables;
3-
using ServiceBricks.Storage.AzureDataTables;
1+
using ServiceBricks.Storage.AzureDataTables;
42

53
namespace ServiceBricks.Cache.AzureDataTables
64
{
@@ -9,14 +7,29 @@ namespace ServiceBricks.Cache.AzureDataTables
97
/// </summary>
108
public partial class CacheData : AzureDataTablesDomainObject<CacheData>, IDpCreateDate, IDpUpdateDate
119
{
12-
public CacheData()
13-
{
14-
}
10+
/// <summary>
11+
/// The cache key.
12+
/// </summary>
13+
public string CacheKey { get; set; }
1514

16-
public virtual string Key { get; set; }
17-
public virtual DateTimeOffset CreateDate { get; set; }
18-
public virtual DateTimeOffset UpdateDate { get; set; }
19-
public virtual DateTimeOffset? ExpirationDate { get; set; }
20-
public virtual string Value { get; set; }
15+
/// <summary>
16+
/// The value.
17+
/// </summary>
18+
public string CacheValue { get; set; }
19+
20+
/// <summary>
21+
/// The creation date.
22+
/// </summary>
23+
public DateTimeOffset CreateDate { get; set; }
24+
25+
/// <summary>
26+
/// The update date.
27+
/// </summary>
28+
public DateTimeOffset UpdateDate { get; set; }
29+
30+
/// <summary>
31+
/// The expiration date.
32+
/// </summary>
33+
public DateTimeOffset? ExpirationDate { get; set; }
2134
}
2235
}

src/V1/ServiceBricks.Cache.AzureDataTables/Extensions/ApplicationBuilderExtensions.cs

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,37 @@
88
namespace ServiceBricks.Cache.AzureDataTables
99
{
1010
/// <summary>
11-
/// IApplicationBuilder extensions for Cache.
11+
/// Extensions for starting the ServiceBricks Cache Azure Data Tables module.
1212
/// </summary>
1313
public static partial class ApplicationBuilderExtensions
1414
{
15+
/// <summary>
16+
/// Flag to indicate if the module has been started.
17+
/// </summary>
1518
public static bool ModuleStarted = false;
1619

20+
/// <summary>
21+
/// Start the ServiceBricks Cache Azure Data Tables module.
22+
/// </summary>
23+
/// <param name="applicationBuilder"></param>
24+
/// <returns></returns>
1725
public static IApplicationBuilder StartServiceBricksCacheAzureDataTables(this IApplicationBuilder applicationBuilder)
1826
{
19-
using (var serviceScope = applicationBuilder.ApplicationServices.GetRequiredService<IServiceScopeFactory>().CreateScope())
20-
{
21-
var configuration = serviceScope.ServiceProvider.GetRequiredService<IConfiguration>();
27+
// AI: Get the connection string
28+
var configuration = applicationBuilder.ApplicationServices.GetRequiredService<IConfiguration>();
29+
var connectionString = configuration.GetAzureDataTablesConnectionString(
30+
CacheAzureDataTablesConstants.APPSETTING_CONNECTION_STRING);
2231

23-
var connectionString = configuration.GetAzureDataTablesConnectionString(
24-
CacheAzureDataTablesConstants.APPSETTING_CONNECTION_STRING);
32+
// AI: Create each table in the module
33+
TableClient tableClient = new TableClient(
34+
connectionString,
35+
CacheAzureDataTablesConstants.GetTableName(nameof(CacheData)));
36+
tableClient.CreateIfNotExists();
2537

26-
// Create each table if not exists
27-
TableClient tableClient = new TableClient(
28-
connectionString,
29-
CacheAzureDataTablesConstants.GetTableName(nameof(CacheData)));
30-
tableClient.CreateIfNotExists();
31-
}
38+
// AI: Set the module started flag
3239
ModuleStarted = true;
3340

34-
// Start core
41+
// AI: Start parent module
3542
applicationBuilder.StartServiceBricksCache();
3643

3744
return applicationBuilder;

src/V1/ServiceBricks.Cache.AzureDataTables/Extensions/ServiceCollectionExtensions.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
using Microsoft.Extensions.Configuration;
22
using Microsoft.Extensions.DependencyInjection;
3-
using Microsoft.Win32;
43

54
namespace ServiceBricks.Cache.AzureDataTables
65
{
76
/// <summary>
8-
/// IServiceCollection extensions for Cache.
7+
/// Extensions for adding the ServiceBricks Cache Azure Data Tables module to the service collection.
98
/// </summary>
10-
public static class ServiceCollectionExtensions
9+
public static partial class ServiceCollectionExtensions
1110
{
11+
/// <summary>
12+
/// Add the ServiceBricks Cache Azure Data Tables module to the service collection.
13+
/// </summary>
14+
/// <param name="services"></param>
15+
/// <param name="configuration"></param>
16+
/// <returns></returns>
1217
public static IServiceCollection AddServiceBricksCacheAzureDataTables(this IServiceCollection services, IConfiguration configuration)
1318
{
14-
// Add to module registry for automapper
19+
// AI: Add the module to the ModuleRegistry
1520
ModuleRegistry.Instance.RegisterItem(typeof(CacheAzureDataTablesModule), new CacheAzureDataTablesModule());
1621

17-
// Add core
22+
// AI: Add parent module
1823
services.AddServiceBricksCache(configuration);
1924

20-
// Storage Services
25+
// AI: Configure all options for the module
26+
27+
// AI: Add storage services for the module. Each domain object should have its own storage repository
2128
services.AddScoped<IStorageRepository<CacheData>, CacheStorageRepository<CacheData>>();
2229

23-
// API Services
30+
// AI: Add API services for the module. Each DTO should have two registrations, one for the generic IApiService<> and one for the named interface
2431
services.AddScoped<IApiService<CacheDataDto>, CacheDataApiService>();
2532
services.AddScoped<ICacheDataApiService, CacheDataApiService>();
2633

27-
// Business Rules
34+
// AI: Register business rules for the module
2835
DomainCreateUpdateDateRule<CacheData>.RegisterRule(BusinessRuleRegistry.Instance);
2936
DomainDateTimeOffsetRule<CacheData>.RegisterRule(BusinessRuleRegistry.Instance, nameof(CacheData.ExpirationDate));
3037
ApiConcurrencyByUpdateDateRule<CacheData, CacheDataDto>.RegisterRule(BusinessRuleRegistry.Instance);

src/V1/ServiceBricks.Cache.AzureDataTables/Mapping/CacheDataMappingProfile.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,26 @@
55
namespace ServiceBricks.Cache.AzureDataTables
66
{
77
/// <summary>
8-
/// This is an automapper profile for the Data domain object.
8+
/// This is an mapping profile for the CacheData domain object.
99
/// </summary>
10-
public class CacheDataMappingProfile : Profile
10+
public partial class CacheDataMappingProfile : Profile
1111
{
12+
/// <summary>
13+
/// Constructor.
14+
/// </summary>
1215
public CacheDataMappingProfile()
1316
{
17+
// AI: Create a mapping profile for CacheDataDto and CacheData.
1418
CreateMap<CacheDataDto, CacheData>()
1519
.ForMember(x => x.CreateDate, y => y.Ignore())
16-
.ForMember(x => x.Key, y => y.MapFrom(z => string.IsNullOrEmpty(z.Key) ? z.StorageKey : z.Key))
20+
.ForMember(x => x.CacheKey, y => y.MapFrom(z => string.IsNullOrEmpty(z.CacheKey) ? z.StorageKey : z.CacheKey))
1721
.ForMember(x => x.PartitionKey, y => y.MapFrom<PartitionKeyResolver>())
1822
.ForMember(x => x.RowKey, y => y.MapFrom<RowKeyResolver>())
1923
.ForMember(x => x.ETag, y => y.Ignore())
2024
.ForMember(x => x.Timestamp, y => y.Ignore());
2125

2226
CreateMap<CacheData, CacheDataDto>()
23-
.ForMember(x => x.StorageKey, y => y.MapFrom(z => z.Key));
27+
.ForMember(x => x.StorageKey, y => y.MapFrom(z => z.CacheKey));
2428
}
2529
}
2630
}

src/V1/ServiceBricks.Cache.AzureDataTables/Model/CacheAzureDataTablesConstants.cs

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
namespace ServiceBricks.Cache.AzureDataTables
22
{
33
/// <summary>
4-
/// This is constants for the Cache module.
4+
/// These are constants for the ServiceBricks Cache Azure Data Tables module.
55
/// </summary>
6-
public static class CacheAzureDataTablesConstants
6+
public static partial class CacheAzureDataTablesConstants
77
{
8+
/// <summary>
9+
/// Application settings keys for the connection string.
10+
/// </summary>
811
public const string APPSETTING_CONNECTION_STRING = "ServiceBricks:Cache:Storage:AzureDataTables:ConnectionString";
912

13+
/// <summary>
14+
/// The table name prefix.
15+
/// </summary>
1016
public const string TABLENAME_PREFIX = "Cache";
1117

18+
/// <summary>
19+
/// Get the table name.
20+
/// </summary>
21+
/// <param name="tableName"></param>
22+
/// <returns></returns>
1223
public static string GetTableName(string tableName)
1324
{
1425
return TABLENAME_PREFIX + tableName;

src/V1/ServiceBricks.Cache.AzureDataTables/Model/CacheAzureDataTablesModule.cs

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,16 @@
22

33
namespace ServiceBricks.Cache.AzureDataTables
44
{
5-
public class CacheAzureDataTablesModule : IModule
5+
/// <summary>
6+
/// The module definition for the ServiceBricks Cache Azure Data Tables module.
7+
/// </summary>
8+
public partial class CacheAzureDataTablesModule : IModule
69
{
10+
/// <summary>
11+
/// Constructor.
12+
/// </summary>
713
public CacheAzureDataTablesModule()
814
{
9-
AdminHtml = string.Empty;
10-
Name = "Cache AzureDataTables Brick";
11-
Description = @"The Cache AzureDataTables Brick implements the Azure Data Tables provider.";
1215
AutomapperAssemblies = new List<Assembly>()
1316
{
1417
typeof(CacheAzureDataTablesModule).Assembly
@@ -19,12 +22,19 @@ public CacheAzureDataTablesModule()
1922
};
2023
}
2124

22-
public string Name { get; }
23-
public string Description { get; }
24-
public string AdminHtml { get; }
25+
/// <summary>
26+
/// The list of dependent modules.
27+
/// </summary>
28+
public List<IModule> DependentModules { get; }
29+
30+
/// <summary>
31+
/// The list of assemblies that contain automapper profiles.
32+
/// </summary>
2533
public List<Assembly> AutomapperAssemblies { get; }
26-
public List<Assembly> ViewAssemblies { get; }
2734

28-
public List<IModule> DependentModules { get; }
35+
/// <summary>
36+
/// The list of assemblies that contain views.
37+
/// </summary>
38+
public List<Assembly> ViewAssemblies { get; }
2939
}
3040
}

src/V1/ServiceBricks.Cache.AzureDataTables/Rule/CacheDataCreateRule.cs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,24 @@
33
namespace ServiceBricks.Cache.AzureDataTables
44
{
55
/// <summary>
6-
/// This is a business rule for the LogMessage object to set the
7-
/// partitionkey and rowkey of the object before create.
6+
/// This is a business rule for creating a CacheData domain object. It will set the PartitionKey and RowKey.
87
/// </summary>
9-
public partial class CacheDataCreateRule : BusinessRule
8+
public sealed class CacheDataCreateRule : BusinessRule
109
{
11-
/// <summary>
12-
/// Internal.
13-
/// </summary>
14-
protected readonly ILogger _logger;
15-
16-
private readonly ITimezoneService _timezoneService;
10+
private readonly ILogger _logger;
1711

1812
/// <summary>
1913
/// Constructor.
2014
/// </summary>
2115
/// <param name="loggerFactory"></param>
22-
public CacheDataCreateRule(ILoggerFactory loggerFactory, ITimezoneService timezoneService)
16+
public CacheDataCreateRule(ILoggerFactory loggerFactory)
2317
{
2418
_logger = loggerFactory.CreateLogger<CacheDataCreateRule>();
25-
_timezoneService = timezoneService;
2619
Priority = PRIORITY_LOW;
2720
}
2821

2922
/// <summary>
30-
/// Register a rule for a domain object.
23+
/// Register the business rule to the DomainCreateBeforeEvent
3124
/// </summary>
3225
public static void RegisterRule(IBusinessRuleRegistry registry)
3326
{
@@ -47,10 +40,12 @@ public override IResponse ExecuteRule(IBusinessRuleContext context)
4740

4841
try
4942
{
50-
if (context.Object is DomainCreateBeforeEvent<CacheData> ei)
43+
// AI: Make sure the context object is the correct type
44+
if (context.Object is DomainCreateBeforeEvent<CacheData> e)
5145
{
52-
var item = ei.DomainObject;
53-
item.PartitionKey = item.Key;
46+
// AI: Set the PartitionKey and RowKey
47+
var item = e.DomainObject;
48+
item.PartitionKey = item.CacheKey;
5449
item.RowKey = string.Empty;
5550
}
5651
}

0 commit comments

Comments
 (0)