Normalize line endings

This commit is contained in:
BinaryAlley committed 2024-10-06 17:58:44 +03:00
1 parent 6bcb337b00
commit 2f18966180
19 files changed
+874 -874

No files matched your search

@@ -1,29 +1,29 @@
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Aggregate Roots.
/// </summary>
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected AggregateRoot(TId id) : base(id)
{
Id = id;
}
#pragma warning disable CS8618
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
protected AggregateRoot() // only needed during reflection
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Aggregate Roots.
/// </summary>
/// <typeparam name="TId">The type representing the unique identifier for the Aggregate Root. It should be a non-nullable type.</typeparam>
public abstract class AggregateRoot<TId> : Entity<TId> where TId : notnull
{
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected AggregateRoot(TId id) : base(id)
{
Id = id;
}
#pragma warning disable CS8618
/// <summary>
/// Initializes a new instance of the <see cref="AggregateRoot{TId}"/> class.
/// </summary>
protected AggregateRoot() // only needed during reflection
{
}
#pragma warning restore CS8618
#endregion
}
#pragma warning restore CS8618
#endregion
}
+100 -100
View File
@@ -1,103 +1,103 @@
#region ========================================================================= USING =====================================================================================
using System;
#endregion
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Entities.
/// </summary>
/// <typeparam name="TId">The type representing the unique identifier for the Entity. It should be a non-nullable type.</typeparam>
public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the unique identifier of the entity.
/// </summary>
public TId Id { get; protected set; }
/// <summary>
/// Gets the date and time when the entity was created.
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// Gets the date and time when the entity was last updated.
/// </summary>
public DateTime? Updated { get; set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected Entity(TId id)
{
Id = id;
}
#pragma warning disable CS8618
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
protected Entity() // only needed during reflection
#region ========================================================================= USING =====================================================================================
using System;
#endregion
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Entities.
/// </summary>
/// <typeparam name="TId">The type representing the unique identifier for the Entity. It should be a non-nullable type.</typeparam>
public abstract class Entity<TId> : IEquatable<Entity<TId>> where TId : notnull
{
#region ==================================================================== PROPERTIES =================================================================================
/// <summary>
/// Gets the unique identifier of the entity.
/// </summary>
public TId Id { get; protected set; }
/// <summary>
/// Gets the date and time when the entity was created.
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// Gets the date and time when the entity was last updated.
/// </summary>
public DateTime? Updated { get; set; }
#endregion
#region ====================================================================== CTOR =====================================================================================
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
/// <param name="id">The id of the entity.</param>
protected Entity(TId id)
{
Id = id;
}
#pragma warning disable CS8618
/// <summary>
/// Initializes a new instance of the <see cref="Entity{TId}"/> class.
/// </summary>
protected Entity() // only needed during reflection
{
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><see langword="true"/> if the current object is equal to the other parameter, <see langword="false"/> otherwise.</returns>
public bool Equals(Entity<TId>? other)
{
return Equals((object?)other);
}
/// <summary>
/// Determines whether the specified objects' Id is equal to the current objects' Id.
/// </summary>
/// <param name="obj">The object whose Id is compared with the current objects' Id.</param>
/// <returns><see langword="true"/> if the specified objects' Id is equal to the current objects' Id, <see langword="false"/> otherwise.</returns>
public override bool Equals(object? obj)
{
return obj is Entity<TId> entity && Id.Equals(entity.Id);
}
/// <summary>
/// Custom implementation of the equality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator ==(Entity<TId> left, Entity<TId> right)
{
return Equals(left, right);
}
/// <summary>
/// Custom implementation of the inequality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is not equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator !=(Entity<TId> left, Entity<TId> right)
{
return !Equals(left, right);
}
/// <summary>
/// Override of the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return Id.GetHashCode();
}
#endregion
}
#pragma warning restore CS8618
#endregion
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><see langword="true"/> if the current object is equal to the other parameter, <see langword="false"/> otherwise.</returns>
public bool Equals(Entity<TId>? other)
{
return Equals((object?)other);
}
/// <summary>
/// Determines whether the specified objects' Id is equal to the current objects' Id.
/// </summary>
/// <param name="obj">The object whose Id is compared with the current objects' Id.</param>
/// <returns><see langword="true"/> if the specified objects' Id is equal to the current objects' Id, <see langword="false"/> otherwise.</returns>
public override bool Equals(object? obj)
{
return obj is Entity<TId> entity && Id.Equals(entity.Id);
}
/// <summary>
/// Custom implementation of the equality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator ==(Entity<TId> left, Entity<TId> right)
{
return Equals(left, right);
}
/// <summary>
/// Custom implementation of the inequality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is not equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator !=(Entity<TId> left, Entity<TId> right)
{
return !Equals(left, right);
}
/// <summary>
/// Override of the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return Id.GetHashCode();
}
#endregion
}
@@ -1,76 +1,76 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Value Objects.
/// </summary>
public abstract class ValueObject : IEquatable<ValueObject>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
/// <returns>A list of items defining the equality.</returns>
public abstract IEnumerable<object?> GetEqualityComponents();
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><see langword="true"/> if the current object is equal to the other parameter, <see langword="false"/> otherwise.</returns>
public bool Equals(ValueObject? other)
{
return Equals((object?)other);
}
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><see langword="true"/> if the specified object is equal to the current object, <see langword="false"/> otherwise.</returns>
public override bool Equals(object? obj)
{
if (obj is null || obj.GetType() != GetType())
return false;
ValueObject valueObject = (ValueObject)obj;
return GetEqualityComponents().SequenceEqual(valueObject.GetEqualityComponents());
}
/// <summary>
/// Custom implementation of the equality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator ==(ValueObject? left, ValueObject? right)
{
return Equals(left, right);
}
/// <summary>
/// Custom implementation of the inequality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is not equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator !=(ValueObject? left, ValueObject? right)
{
return !Equals(left, right);
}
/// <summary>
/// Override of the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return GetEqualityComponents().Select(x => x?.GetHashCode() ?? 0)
.Aggregate((x, y) => x ^ y);
}
#endregion
#region ========================================================================= USING =====================================================================================
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace Lumina.Domain.Common.Models.Core;
/// <summary>
/// Base class for all domain Value Objects.
/// </summary>
public abstract class ValueObject : IEquatable<ValueObject>
{
#region ===================================================================== METHODS ===================================================================================
/// <summary>
/// Gets the list of items that define equality of the object.
/// </summary>
/// <returns>A list of items defining the equality.</returns>
public abstract IEnumerable<object?> GetEqualityComponents();
/// <summary>
/// Indicates whether the current object is equal to another object of the same type.
/// </summary>
/// <param name="other">An object to compare with this object.</param>
/// <returns><see langword="true"/> if the current object is equal to the other parameter, <see langword="false"/> otherwise.</returns>
public bool Equals(ValueObject? other)
{
return Equals((object?)other);
}
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns><see langword="true"/> if the specified object is equal to the current object, <see langword="false"/> otherwise.</returns>
public override bool Equals(object? obj)
{
if (obj is null || obj.GetType() != GetType())
return false;
ValueObject valueObject = (ValueObject)obj;
return GetEqualityComponents().SequenceEqual(valueObject.GetEqualityComponents());
}
/// <summary>
/// Custom implementation of the equality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator ==(ValueObject? left, ValueObject? right)
{
return Equals(left, right);
}
/// <summary>
/// Custom implementation of the inequality operator.
/// </summary>
/// <param name="left">The left operand of equality.</param>
/// <param name="right">The right operand of equality.</param>
/// <returns><see langword="true"/> if <paramref name="left"/> is not equal to <paramref name="right"/>, <see langword="false"/> otherwise.</returns>
public static bool operator !=(ValueObject? left, ValueObject? right)
{
return !Equals(left, right);
}
/// <summary>
/// Override of the default hash function.
/// </summary>
/// <returns>A hash code for the current object.</returns>
public override int GetHashCode()
{
return GetEqualityComponents().Select(x => x?.GetHashCode() ?? 0)
.Aggregate((x, y) => x ^ y);
}
#endregion
}
+27 -27
View File
@@ -1,27 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ErrorOr" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="System.IO.Abstractions" Version="21.0.29" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lumina.Contracts\Lumina.Contracts.csproj" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<BaseOutputPath>$(SolutionDir)..\bin\server\</BaseOutputPath>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\AssemblyInfo_Shared.cs" Link="Properties\AssemblyInfo_Shared.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="ErrorOr" Version="2.0.1" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" />
<PackageReference Include="System.IO.Abstractions" Version="21.0.29" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lumina.Contracts\Lumina.Contracts.csproj" />
</ItemGroup>
</Project>