Skip to content

Commit

Permalink
Release/7.0.0 (#103)
Browse files Browse the repository at this point in the history
* Refactor: Invokers

* test coverage & fixes

* code cleanup r#
db Application as decorator
tenant default culture removed

* test coverage

* integration fixes

* message bus invocation sequentialized, waiting for app boot

* logging

* compile fix

* no exception logging or handling in invoker

* typo

* flexible MessageName vs. Event Type
Messagebus.Connect on boot

* test fixes

* test logging

* test ignored on CI pipeline

* exception handling

* Serilog Implementation

* auto registration of integration message handlers

* removed call to obsolete logger func

* sourcelink, absolete calls in tests

* Create Logger by string category tries to derive a type

* EF Core 5.0

* JetBrains.Annotations bumped

* logging bumps
  • Loading branch information
marcwittke authored Feb 13, 2021
1 parent adbbbd9 commit 433e5ed
Show file tree
Hide file tree
Showing 340 changed files with 7,577 additions and 5,266 deletions.
14 changes: 13 additions & 1 deletion Backend.Fx.sln
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backend.Fx.InMemoryPersiste
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Backend.Fx.Log4NetLogging", "src\implementations\Backend.Fx.Log4NetLogging\Backend.Fx.Log4NetLogging.csproj", "{C27BA4CE-882B-405F-906E-4DFA6E9F1216}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "_build", "build\_build.csproj", "{DFD5E4B8-2479-4D29-9857-9199B94E412A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend.Fx.RabbitMq.Tests", "tests\Backend.Fx.RabbitMq.Tests\Backend.Fx.RabbitMq.Tests.csproj", "{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Backend.Fx.SerilogLogging", "src\implementations\Backend.Fx.SerilogLogging\Backend.Fx.SerilogLogging.csproj", "{33F7D896-2276-4DD7-A4DA-8FD5C47F7735}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -108,6 +110,14 @@ Global
{C27BA4CE-882B-405F-906E-4DFA6E9F1216}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C27BA4CE-882B-405F-906E-4DFA6E9F1216}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C27BA4CE-882B-405F-906E-4DFA6E9F1216}.Release|Any CPU.Build.0 = Release|Any CPU
{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A}.Release|Any CPU.Build.0 = Release|Any CPU
{33F7D896-2276-4DD7-A4DA-8FD5C47F7735}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33F7D896-2276-4DD7-A4DA-8FD5C47F7735}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33F7D896-2276-4DD7-A4DA-8FD5C47F7735}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33F7D896-2276-4DD7-A4DA-8FD5C47F7735}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -129,6 +139,8 @@ Global
{45EC5987-1C85-4940-8E5E-3B4F0FA90AF8} = {56ACAE69-F7F0-4FF2-BEE6-4B079481CF9A}
{0B8F13CA-1347-4655-9D41-AED21B1AFAC4} = {739A7296-579F-4D9A-BC73-DCECD260D7A0}
{C27BA4CE-882B-405F-906E-4DFA6E9F1216} = {739A7296-579F-4D9A-BC73-DCECD260D7A0}
{6D0A5E9D-2FA5-4CC9-96B0-C2C871335E3A} = {C7885592-A4B8-4BA8-8D3A-1EDA4025D17A}
{33F7D896-2276-4DD7-A4DA-8FD5C47F7735} = {739A7296-579F-4D9A-BC73-DCECD260D7A0}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {45648557-C751-44AD-9C87-0F12EB673969}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ Vendor | Library | .NET Standard | NuGet
[Entity Framework Core 2.1](https://github.com/aspnet/EntityFramework) as persistence mechanism | Backend.Fx.EfCorePersistence | 2.0 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.EfCorePersistence.svg)](https://www.nuget.org/packages/Backend.Fx.EfCorePersistence)
InMemory Persistence implementation | Backend.Fx.InMemoryPersistence | 1.3 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.InMemoryPersistence.svg)](https://www.nuget.org/packages/Backend.Fx.InMemoryPersistence)
[NLog](https://github.com/NLog/NLog) logging | Backend.Fx.NLogLogging | 1.6 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.NLogLogging.svg)](https://www.nuget.org/packages/Backend.Fx.NLogLogging)
[RabbitMq](https://www.rabbitmq.com/) Event Bus | Backend.Fx.RabbitMq | 1.5 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.RabbitMq.svg)](https://www.nuget.org/packages/Backend.Fx.RabbitMq)
[RabbitMq](https://www.rabbitmq.com/) Message Bus | Backend.Fx.RabbitMq | 1.5 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.RabbitMq.svg)](https://www.nuget.org/packages/Backend.Fx.RabbitMq)
[Simple Injector](https://github.com/simpleinjector/SimpleInjector) as DI container | Backend.Fx.SimpleInjectorDependencyInjection | 1.3 | [![NuGet](https://img.shields.io/nuget/v/Backend.Fx.SimpleInjectorDependencyInjection.svg)](https://www.nuget.org/packages/Backend.Fx.SimpleInjectorDependencyInjection)
4 changes: 2 additions & 2 deletions src/abstractions/Backend.Fx/Backend.Fx.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.3" />
<PackageReference Include="JetBrains.Annotations" Version="2020.3.0" />
<PackageReference Include="Microsoft.CSharp" Version="4.6.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
<PackageReference Include="System.Data.Common" Version="4.1.0" />
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.0.8.16" />
<PackageReference Include="System.Linq.Queryable" Version="4.3.0" />
<PackageReference Include="System.Security.Principal" Version="4.3.0" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19324-01" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>
9 changes: 6 additions & 3 deletions src/abstractions/Backend.Fx/BuildingBlocks/AggregateRoot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
public abstract class AggregateRoot : Entity
{
protected AggregateRoot()
{ }
{
}

protected AggregateRoot(int id) : base(id) { }
protected AggregateRoot(int id) : base(id)
{
}

public int TenantId { get; set; }
}
}
}
29 changes: 13 additions & 16 deletions src/abstractions/Backend.Fx/BuildingBlocks/Entity.cs
Original file line number Diff line number Diff line change
@@ -1,50 +1,45 @@
using Backend.Fx.Extensions;
using System;
using System.ComponentModel.DataAnnotations;
using Backend.Fx.Extensions;
using JetBrains.Annotations;

namespace Backend.Fx.BuildingBlocks
{
using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using JetBrains.Annotations;

/// <summary>
/// An object that is not defined by its attributes, but rather by a thread of continuity and its identity.
/// https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks
/// </summary>
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + "}")]
public abstract class Entity : Identified
{
protected Entity()
{ }
{
}

protected Entity(int id)
{
Id = id;
}

[UsedImplicitly]
public string DebuggerDisplay => $"{GetType().Name}[{Id}]";

public DateTime CreatedOn { get; protected set; }

[StringLength(100)]
public string CreatedBy { get; protected set; }
[StringLength(100)] public string CreatedBy { get; protected set; }

public DateTime? ChangedOn { get; protected set; }

[StringLength(100)]
public string ChangedBy { get; protected set; }
[StringLength(100)] public string ChangedBy { get; protected set; }

public void SetCreatedProperties([NotNull] string createdBy, DateTime createdOn)
{
if (createdBy == null)
{
throw new ArgumentNullException(nameof(createdBy));
}

if (createdBy == string.Empty)
{
throw new ArgumentException(nameof(createdBy));
}

CreatedBy = createdBy.Cut(100);
CreatedOn = createdOn;
}
Expand All @@ -55,12 +50,14 @@ public void SetModifiedProperties([NotNull] string changedBy, DateTime changedOn
{
throw new ArgumentNullException(nameof(changedBy));
}

if (changedBy == string.Empty)
{
throw new ArgumentException(nameof(changedBy));
}

ChangedBy = changedBy.Cut(100);
ChangedOn = changedOn;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
/// A marker interface to identify application services to be auto registered in the container on boot
/// </summary>
public interface IApplicationService
{ }
}
{
}
}
5 changes: 3 additions & 2 deletions src/abstractions/Backend.Fx/BuildingBlocks/IDomainService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@
/// A marker interface to domain application services to be auto registered in the container on boot
/// </summary>
public interface IDomainService
{ }
}
{
}
}

This file was deleted.

11 changes: 5 additions & 6 deletions src/abstractions/Backend.Fx/BuildingBlocks/IRepository.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace Backend.Fx.BuildingBlocks
{
using System.Collections.Generic;
using System.Linq;
using System.Collections.Generic;
using System.Linq;

namespace Backend.Fx.BuildingBlocks
{
/// <summary>
/// Encapsulates methods for retrieving domain objects
/// See https://en.wikipedia.org/wiki/Domain-driven_design#Building_blocks
Expand All @@ -19,6 +19,5 @@ public interface IRepository<TAggregateRoot> where TAggregateRoot : AggregateRoo
bool Any();
TAggregateRoot[] Resolve(IEnumerable<int> ids);
IQueryable<TAggregateRoot> AggregateQueryable { get; }

}
}
}
19 changes: 10 additions & 9 deletions src/abstractions/Backend.Fx/BuildingBlocks/IView.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
namespace Backend.Fx.BuildingBlocks
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

namespace Backend.Fx.BuildingBlocks
{
public interface IView<out T> : IQueryable<T>
{}
{
}

public abstract class View<T> : IView<T>
{
Expand All @@ -34,4 +35,4 @@ IEnumerator IEnumerable.GetEnumerator()

public IQueryProvider Provider => _viewImplementation.Provider;
}
}
}
13 changes: 8 additions & 5 deletions src/abstractions/Backend.Fx/BuildingBlocks/Identified.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Diagnostics;
using JetBrains.Annotations;

namespace Backend.Fx.BuildingBlocks
{
[DebuggerDisplay("{" + nameof(DebuggerDisplay) + "}")]
public abstract class Identified : IEquatable<Identified>
{
[Key]
public int Id { get; set; }
[Key] public int Id { get; set; }

[UsedImplicitly] public string DebuggerDisplay => $"{GetType().Name}[{Id}]";

public bool Equals(Identified other)
{
Expand All @@ -21,7 +24,7 @@ public bool Equals(Identified other)

public override bool Equals(object obj)
{
Identified other = obj as Identified;
var other = obj as Identified;
if (other == null)
{
return false;
Expand All @@ -40,7 +43,7 @@ public override int GetHashCode()
// ReSharper enable NonReadonlyMemberInGetHashCode

// ReSharper disable once BaseObjectGetHashCodeCallInGetHashCode
return base.GetHashCode();
return base.GetHashCode();
}

public static bool operator ==(Identified x, Identified y)
Expand All @@ -53,4 +56,4 @@ public override int GetHashCode()
return !(x == y);
}
}
}
}
26 changes: 13 additions & 13 deletions src/abstractions/Backend.Fx/BuildingBlocks/Repository.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
namespace Backend.Fx.BuildingBlocks
using System;
using System.Collections.Generic;
using System.Linq;
using Backend.Fx.Environment.MultiTenancy;
using Backend.Fx.Exceptions;
using Backend.Fx.Extensions;
using Backend.Fx.Logging;
using Backend.Fx.Patterns.Authorization;
using Backend.Fx.Patterns.DependencyInjection;
using JetBrains.Annotations;

namespace Backend.Fx.BuildingBlocks
{
using System;
using System.Collections.Generic;
using System.Linq;
using Environment.MultiTenancy;
using Exceptions;
using Extensions;
using JetBrains.Annotations;
using Logging;
using Patterns.Authorization;
using Patterns.DependencyInjection;

public abstract class Repository<TAggregateRoot> : IRepository<TAggregateRoot> where TAggregateRoot : AggregateRoot
{
private static readonly ILogger Logger = LogManager.Create<Repository<TAggregateRoot>>();
Expand Down Expand Up @@ -45,7 +45,7 @@ public IQueryable<TAggregateRoot> AggregateQueryable
public TAggregateRoot Single(int id)
{
Logger.Debug($"Getting single {AggregateTypeName}[{id}]");
var aggregateRoot = AggregateQueryable.FirstOrDefault(aggr => aggr.Id.Equals(id));
TAggregateRoot aggregateRoot = AggregateQueryable.FirstOrDefault(aggr => aggr.Id.Equals(id));
if (aggregateRoot == null)
{
throw new NotFoundException<TAggregateRoot>(id);
Expand Down
Loading

0 comments on commit 433e5ed

Please sign in to comment.