Skip to content

Commit

Permalink
Updated logging packages.
Browse files Browse the repository at this point in the history
Corrected an incorrect exception type being raised for connection strings.
Corrected a file and class name TableStoragEventStoreModule => TableStorageEventStoreModule.
Added .NET Core dependency modules for blob and table storage data stores and event stores.
  • Loading branch information
cdmdotnet committed Oct 20, 2024
1 parent 578c25b commit 702c32f
Show file tree
Hide file tree
Showing 40 changed files with 267 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="Microsoft.Azure.DocumentDB" Version="1.21.1" />
<PackageReference Include="Microsoft.Azure.DocumentDB.TransientFaultHandling" Version="1.5.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging.Azure.ApplicationInsights" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.45" />
<PackageReference Include="Chinchilla.Logging.Azure.ApplicationInsights" Version="5.2.45" />

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging.Azure.ApplicationInsights" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.45" />
<PackageReference Include="Chinchilla.Logging.Azure.ApplicationInsights" Version="5.2.45" />

<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
<PackageReference Include="Microsoft.ApplicationInsights.WorkerService" Version="2.21.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<PackageReference Include="Azure.Data.Tables" Version="12.8.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="6.0.1" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,13 @@ public virtual IEnumerable<string> GetWritableConnectionStrings()
}

if (!collection.Any())
throw new MissingApplicationSettingException(TableStorageDataStoreConnectionStringKey);
throw new MissingConnectionStringException(TableStorageDataStoreConnectionStringKey);

return collection;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(TableStorageDataStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(TableStorageDataStoreConnectionStringKey, exception);
}
finally
{
Expand All @@ -123,13 +123,13 @@ public virtual string GetReadableConnectionString()
}

if (string.IsNullOrWhiteSpace(blobStorageWritableDataStoreConnectionString))
throw new MissingApplicationSettingException(TableStorageDataStoreConnectionStringKey);
throw new MissingConnectionStringException(TableStorageDataStoreConnectionStringKey);

return blobStorageWritableDataStoreConnectionString;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(TableStorageDataStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(TableStorageDataStoreConnectionStringKey, exception);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public virtual IEnumerable<string> GetWritableConnectionStrings()
}

if (!collection.Any())
throw new MissingApplicationSettingException(BlobStorageEventStoreConnectionStringKey);
throw new MissingConnectionStringException(BlobStorageEventStoreConnectionStringKey);

return collection;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(BlobStorageEventStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(BlobStorageEventStoreConnectionStringKey, exception);
}
finally
{
Expand All @@ -124,13 +124,13 @@ public virtual string GetReadableConnectionString()
}

if (string.IsNullOrWhiteSpace(blobStorageWritableEventStoreConnectionString))
throw new MissingApplicationSettingException(BlobStorageEventStoreConnectionStringKey);
throw new MissingConnectionStringException(BlobStorageEventStoreConnectionStringKey);

return blobStorageWritableEventStoreConnectionString;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(BlobStorageEventStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(BlobStorageEventStoreConnectionStringKey, exception);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ public override IEnumerable<string> GetWritableConnectionStrings()
}

if (!collection.Any())
throw new MissingApplicationSettingException(BlobStorageSnapshotStoreConnectionStringKey);
throw new MissingConnectionStringException(BlobStorageSnapshotStoreConnectionStringKey);

return collection;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(BlobStorageSnapshotStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(BlobStorageSnapshotStoreConnectionStringKey, exception);
}
finally
{
Expand All @@ -114,13 +114,13 @@ public override string GetReadableConnectionString()
}

if (string.IsNullOrWhiteSpace(blobStorageWritableSnapshotStoreConnectionString))
throw new MissingApplicationSettingException(BlobStorageSnapshotStoreConnectionStringKey);
throw new MissingConnectionStringException(BlobStorageSnapshotStoreConnectionStringKey);

return blobStorageWritableSnapshotStoreConnectionString;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(BlobStorageSnapshotStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(BlobStorageSnapshotStoreConnectionStringKey, exception);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,13 @@ public override IEnumerable<string> GetWritableConnectionStrings()
}

if (!collection.Any())
throw new MissingApplicationSettingException(TableStorageSnapshotStoreConnectionStringKey);
throw new MissingConnectionStringException(TableStorageSnapshotStoreConnectionStringKey);

return collection;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(TableStorageSnapshotStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(TableStorageSnapshotStoreConnectionStringKey, exception);
}
finally
{
Expand All @@ -114,13 +114,13 @@ public override string GetReadableConnectionString()
}

if (string.IsNullOrWhiteSpace(tableStorageWritableSnapshotStoreConnectionString))
throw new MissingApplicationSettingException(TableStorageSnapshotStoreConnectionStringKey);
throw new MissingConnectionStringException(TableStorageSnapshotStoreConnectionStringKey);

return tableStorageWritableSnapshotStoreConnectionString;
}
catch (NullReferenceException exception)
{
throw new MissingApplicationSettingException(TableStorageSnapshotStoreConnectionStringKey, exception);
throw new MissingConnectionStringException(TableStorageSnapshotStoreConnectionStringKey, exception);
}
finally
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging.Azure" Version="5.2.45" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Ninject" Version="3.2.2.0" />
Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs.MongoDB/Cqrs.MongoDB.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="MongoDB.Driver" Version="2.22.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs.Sql/Cqrs.Sql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
<PackageReference Include="cdmdotnet.AutoMapper" Version="1.0.16.9" />

<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="NUnit" Version="2.6.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="NUnit" Version="2.6.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs.Tests/Cqrs.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="NUnit" Version="2.6.3" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs.Web.Mvc/Cqrs.Web.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs.WebApi/Cqrs.WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Framework/Cqrs/Cqrs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@

<ItemGroup>
<PackageReference Include="Chinchilla.StateManagement" Version="4.2.11" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.44" />
<PackageReference Include="Chinchilla.Logging" Version="5.2.45" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#region Copyright
// // -----------------------------------------------------------------------
// // <copyright company="Chinchilla Software Limited">
// // Copyright Chinchilla Software Limited. All rights reserved.
// // </copyright>
// // -----------------------------------------------------------------------
#endregion

using System;
using Cqrs.Azure.Storage;
using Cqrs.Azure.Storage.Events;
using Cqrs.DependencyInjection.Modules;
using Cqrs.Events;
using Cqrs.Snapshots;
using Microsoft.Extensions.DependencyInjection;

namespace Cqrs.DependencyInjection.Azure.Storage.Configuration
{
/// <summary>
/// A <see cref="Module"/> that wires up the prerequisites of <see cref="IEventStore{TAuthenticationToken}"/> with blob storage.
/// </summary>
/// <typeparam name="TAuthenticationToken">The <see cref="Type"/> of the authentication token.</typeparam>
public class AzureBlobStoragEventStoreModule<TAuthenticationToken> : ResolvableModule
{
#region Overrides of ResolvableModule

/// <summary>
/// Loads the module into the kernel.
/// </summary>
public override void Load(IServiceCollection services)
{
RegisterFactories(services);
RegisterEventSerialisationConfiguration(services);
RegisterEventStore(services);
}

#endregion

/// <summary>
/// Register the all factories
/// </summary>
public virtual void RegisterFactories(IServiceCollection services)
{
services.AddSingleton<IBlobStorageStoreConnectionStringFactory, BlobStorageEventStoreConnectionStringFactory>();
services.AddSingleton<IBlobStorageSnapshotStoreConnectionStringFactory, BlobStorageSnapshotStoreConnectionStringFactory>();
}

/// <summary>
/// Register the all event serialisation configurations
/// </summary>
public virtual void RegisterEventSerialisationConfiguration(IServiceCollection services)
{
services.AddSingleton<IEventBuilder<TAuthenticationToken>, DefaultEventBuilder<TAuthenticationToken>>();
services.AddSingleton<IEventDeserialiser<TAuthenticationToken>, EventDeserialiser<TAuthenticationToken>>();
services.AddSingleton<ISnapshotDeserialiser, SnapshotDeserialiser>();
}

/// <summary>
/// Register the <see cref="IEventStore{TAuthenticationToken}"/>
/// </summary>
public virtual void RegisterEventStore(IServiceCollection services)
{
services.AddSingleton<IEventStore<TAuthenticationToken>, BlobStorageEventStore<TAuthenticationToken>>();
services.AddSingleton<ISnapshotStore, BlobStorageSnapshotStore>();
}
}
}
Loading

0 comments on commit 702c32f

Please sign in to comment.