Skip to content

Commit

Permalink
Merge pull request #36 from NerosoftDev/net8.0
Browse files Browse the repository at this point in the history
Net8.0
  • Loading branch information
Codespilot authored Dec 4, 2023
2 parents 456b537 + 1bed4cc commit 85d26e3
Show file tree
Hide file tree
Showing 27 changed files with 245 additions and 227 deletions.
1 change: 1 addition & 0 deletions Euonia.sln
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{CC
ProjectSection(SolutionItems) = preProject
Directory.Packages.props = Directory.Packages.props
NuGet.config = NuGet.config
project.props = project.props
README.md = README.md
EndProjectSection
EndProject
Expand Down
13 changes: 4 additions & 9 deletions Samples/common.props
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
<Project>
<Import Project="..\project.props" />

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Nerosoft.Euonia.Sample</RootNamespace>
<Version>8.0.0</Version>
<Authors>damon</Authors>
<Company>Nerosoft Co., Ltd.</Company>
<Product>Euonia</Product>
<Copyright>© 2018-2023 Nerosoft. All Rights Reserved.</Copyright>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<LangVersion>latest</LangVersion>
<Description>Euonia development framework and toolkit library for .NET application/service. Powered by Nerosoft.</Description>
<Configurations>Debug;Release;Product</Configurations>
<IsPackable>false</IsPackable>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
Expand Down
1 change: 1 addition & 0 deletions Source/Euonia.Bus.Abstract/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
[assembly: InternalsVisibleTo("Euonia.Bus")]


// ReSharper disable once EmptyNamespace
namespace Nerosoft.Euonia.Bus.Properties;
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class AsyncCollectionRequestMessage<T> : IAsyncEnumerable<T>
/// </code>
/// If we also want to control the cancellation of the token passed to each subscriber to the message,
/// we can do so by passing a token we control to the returned message before starting the enumeration
/// (<see cref="TaskAsyncEnumerableExtensions.WithCancellation{T}(IAsyncEnumerable{T}, CancellationToken)"/>).
/// (<see cref="TaskAsyncEnumerableExtensions.WithCancellation{T}"/>).
/// The previous snippet with this additional change looks as follows:
/// <code>
/// await foreach (var document in Messenger.Default.Send&lt;OpenDocumentsRequestMessage&gt;().WithCancellation(cts.Token))
Expand All @@ -52,7 +52,7 @@ public class AsyncCollectionRequestMessage<T> : IAsyncEnumerable<T>
/// itself will automatically be linked and canceled with the one passed to the enumerator.
/// </summary>
public CancellationToken CancellationToken => _cancellationTokenSource.Token;

/// <summary>
/// Replies to the current request message.
/// </summary>
Expand Down
5 changes: 2 additions & 3 deletions Source/Euonia.Bus.RabbitMq/RabbitMqQueueConsumer.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System.Threading.Channels;
using Microsoft.Extensions.Options;
using Microsoft.Extensions.Options;
using RabbitMQ.Client;
using RabbitMQ.Client.Events;

namespace Nerosoft.Euonia.Bus.RabbitMq;

/// <summary>
///
/// The RabbitMQ implementation of <see cref="IQueueConsumer"/>.
/// </summary>
public class RabbitMqQueueConsumer : RabbitMqQueueRecipient, IQueueConsumer
{
Expand Down
8 changes: 6 additions & 2 deletions Source/Euonia.Bus/Messages/MessageBusException.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System.Runtime.Serialization;
#if !NET8_0_OR_GREATER
using System.Runtime.Serialization;
#endif

namespace Nerosoft.Euonia.Bus;

Expand All @@ -10,7 +12,7 @@ namespace Nerosoft.Euonia.Bus;
[Serializable]
public class MessageBusException : Exception
{
private object _message;
private readonly object _message;

/// <summary>
/// Initializes a new instance of the <see cref="MessageBusException"/> class.
Expand Down Expand Up @@ -50,6 +52,7 @@ public MessageBusException(object messageContext, string message, Exception inne
/// <value>The type of the message.</value>
public virtual object MessageContext => _message;

#if !NET8_0_OR_GREATER
/// <inheritdoc />
public MessageBusException(SerializationInfo info, StreamingContext context)
: base(info, context)
Expand All @@ -63,4 +66,5 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
base.GetObjectData(info, context);
info.AddValue(nameof(MessageContext), _message, MessageContext.GetType());
}
#endif
}
3 changes: 3 additions & 0 deletions Source/Euonia.Core/Euonia.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,7 @@
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Using Include="System.Runtime.Serialization" />
</ItemGroup>
</Project>
13 changes: 7 additions & 6 deletions Source/Euonia.Core/Exceptions/BadGatewayException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;

Expand All @@ -18,11 +17,13 @@ public BadGatewayException()
{
}

/// <inheritdoc />
protected BadGatewayException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public BadGatewayException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <inheritdoc />
public BadGatewayException(string message)
Expand Down
13 changes: 7 additions & 6 deletions Source/Euonia.Core/Exceptions/BadRequestException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;

Expand All @@ -17,11 +16,13 @@ public BadRequestException()
{
}

/// <inheritdoc />
protected BadRequestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public BadRequestException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <inheritdoc />
public BadRequestException(string message)
Expand Down
108 changes: 54 additions & 54 deletions Source/Euonia.Core/Exceptions/BusinessException.cs
Original file line number Diff line number Diff line change
@@ -1,68 +1,68 @@
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;
namespace Nerosoft.Euonia.Core;

/// <summary>
/// Represents errors that occur during business logic execution.
/// </summary>
[Serializable]
public class BusinessException : Exception
{
private readonly string _code;
private readonly string _code;

/// <summary>
/// Gets the business error code.
/// </summary>
public virtual string Code => _code;
/// <summary>
/// Gets the business error code.
/// </summary>
public virtual string Code => _code;

/// <inheritdoc />
public BusinessException()
{
}
/// <inheritdoc />
public BusinessException()
{
}

/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code.
/// </summary>
/// <param name="code">The error code.</param>
public BusinessException(string code)
{
_code = code;
}
/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code.
/// </summary>
/// <param name="code">The error code.</param>
public BusinessException(string code)
{
_code = code;
}

/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code and message.
/// </summary>
/// <param name="code">The error code.</param>
/// <param name="message">The error message.</param>
public BusinessException(string code, string message)
: base(message)
{
_code = code;
}
/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code and message.
/// </summary>
/// <param name="code">The error code.</param>
/// <param name="message">The error message.</param>
public BusinessException(string code, string message)
: base(message)
{
_code = code;
}

/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code, message and inner exception.
/// </summary>
/// <param name="code">The error code.</param>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public BusinessException(string code, string message, Exception innerException)
: base(message, innerException)
{
_code = code;
}
/// <summary>
/// Initialize a new instance of the <see cref="BusinessException"/> with error code, message and inner exception.
/// </summary>
/// <param name="code">The error code.</param>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception.</param>
public BusinessException(string code, string message, Exception innerException)
: base(message, innerException)
{
_code = code;
}

/// <inheritdoc />
protected BusinessException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_code = info.GetString(nameof(Code));
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public BusinessException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
_code = info.GetString(nameof(Code));
}

/// <inheritdoc />
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue(nameof(Code), _code, typeof(string));
}
}
/// <inheritdoc />
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
info.AddValue(nameof(Code), _code, typeof(string));
}
#endif
}
16 changes: 8 additions & 8 deletions Source/Euonia.Core/Exceptions/ConfigurationException.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;
namespace Nerosoft.Euonia.Core;

/// <summary>
/// Represents errors that occur during application configuration.
Expand Down Expand Up @@ -34,9 +32,11 @@ public ConfigurationException(string message, Exception innerException)
{
}

/// <inheritdoc />
protected ConfigurationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public ConfigurationException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif
}
13 changes: 7 additions & 6 deletions Source/Euonia.Core/Exceptions/ConflictException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;

Expand All @@ -17,11 +16,13 @@ public ConflictException()
{
}

/// <inheritdoc />
protected ConflictException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public ConflictException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <inheritdoc />
public ConflictException(string message)
Expand Down
13 changes: 7 additions & 6 deletions Source/Euonia.Core/Exceptions/ForbiddenException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;

Expand All @@ -17,11 +16,13 @@ public ForbiddenException()
{
}

/// <inheritdoc />
protected ForbiddenException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public ForbiddenException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <inheritdoc />
public ForbiddenException(string message)
Expand Down
17 changes: 9 additions & 8 deletions Source/Euonia.Core/Exceptions/GatewayTimeoutException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Net;
using System.Runtime.Serialization;

namespace Nerosoft.Euonia.Core;

Expand All @@ -17,14 +16,16 @@ public GatewayTimeoutException()
{
}

/// <inheritdoc />
protected GatewayTimeoutException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#if !NET8_0_OR_GREATER
/// <inheritdoc />
public GatewayTimeoutException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
#endif

/// <inheritdoc />
public GatewayTimeoutException(string message)
/// <inheritdoc />
public GatewayTimeoutException(string message)
: base(message)
{
}
Expand Down
Loading

0 comments on commit 85d26e3

Please sign in to comment.