Commit 29cc9621 authored by hasan khaddour's avatar hasan khaddour

fix s.

parent 157eceaa
using FluentResults; 
using Ardalis.Result;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
...@@ -7,18 +8,14 @@ using System.Threading.Tasks; ...@@ -7,18 +8,14 @@ using System.Threading.Tasks;
namespace PSManagement.SharedKernel.DomainErrors namespace PSManagement.SharedKernel.DomainErrors
{ {
public class DomainError : Error public class DomainError :ValidationError
{ {
public DomainError(string message) : base(message) public DomainError(string errorCode, string errorMessage) :base()
{ {
this.ErrorMessage = errorMessage;
this.ErrorCode = errorCode;
} }
public DomainError(string message, IError causedBy) : base(message, causedBy)
{
}
protected DomainError()
{
}
} }
} }
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="FluentResults" Version="3.16.0" /> <PackageReference Include="Ardalis.Result" Version="9.0.0" />
<PackageReference Include="ErrorOr" Version="2.0.1" />
<PackageReference Include="MediatR" Version="8.0.1" /> <PackageReference Include="MediatR" Version="8.0.1" />
</ItemGroup> </ItemGroup>
......
...@@ -13,7 +13,7 @@ namespace PSManagement.SharedKernel.Specification ...@@ -13,7 +13,7 @@ namespace PSManagement.SharedKernel.Specification
{ {
Criteria = criteria; Criteria = criteria;
} }
public Expression<Func<T, bool>> Criteria { get; } public Expression<Func<T, bool>> Criteria { get; set; }
public List<Expression<Func<T, object>>> Includes { get; } = new List<Expression<Func<T, object>>>(); public List<Expression<Func<T, object>>> Includes { get; } = new List<Expression<Func<T, object>>>();
public List<string> IncludeStrings { get; } = new List<string>(); public List<string> IncludeStrings { get; } = new List<string>();
public Expression<Func<T, object>> OrderBy { get; private set; } public Expression<Func<T, object>> OrderBy { get; private set; }
......
...@@ -39,15 +39,15 @@ namespace PSManagement.SharedKernel.Utilities ...@@ -39,15 +39,15 @@ namespace PSManagement.SharedKernel.Utilities
public static Result<TValue> Failure<TValue>(Error error) => new(default, false, error); public static Result<TValue> Failure<TValue>(Error error) => new(default, false, error);
public static Result<TValue> Create<TValue>(TValue? value) => public static Result<TValue> Create<TValue>(TValue value) =>
value is not null ? Success(value) : Failure<TValue>(Error.NullValue); value is not null ? Success(value) : Failure<TValue>(Error.NullValue);
} }
public class Result<TValue> : Result public class Result<TValue> : Result
{ {
private readonly TValue? _value; private readonly TValue _value;
protected internal Result(TValue? value, bool isSuccess, Error error) protected internal Result(TValue value, bool isSuccess, Error error)
: base(isSuccess, error) : base(isSuccess, error)
{ {
_value = value; _value = value;
...@@ -58,6 +58,6 @@ namespace PSManagement.SharedKernel.Utilities ...@@ -58,6 +58,6 @@ namespace PSManagement.SharedKernel.Utilities
? _value! ? _value!
: throw new InvalidOperationException("The value of a failure result can not be accessed."); : throw new InvalidOperationException("The value of a failure result can not be accessed.");
public static implicit operator Result<TValue>(TValue? value) => Create(value); public static implicit operator Result<TValue>(TValue value) => Create(value);
} }
} }
...@@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSManagement.Infrastructure ...@@ -41,6 +41,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PSManagement.Infrastructure
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence", "{E40CD9A8-20E3-4D39-992B-F7DA048E3B4C}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Persistence", "Persistence", "{E40CD9A8-20E3-4D39-992B-F7DA048E3B4C}"
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Services", "Services", "{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
...@@ -90,7 +92,7 @@ Global ...@@ -90,7 +92,7 @@ Global
{1EA4D7A7-EF37-43C4-8704-223CD7F44162} = {A8A58969-B142-4968-982B-16F771A7C805} {1EA4D7A7-EF37-43C4-8704-223CD7F44162} = {A8A58969-B142-4968-982B-16F771A7C805}
{34AD12C1-6312-4F2A-8297-645BC8221C8B} = {F823B488-2A6B-40C0-B332-65C861DA40E3} {34AD12C1-6312-4F2A-8297-645BC8221C8B} = {F823B488-2A6B-40C0-B332-65C861DA40E3}
{3507E59A-4B8B-4418-B1C6-0AD0C2697959} = {9C4A8DA5-024F-48AD-BD57-37FC8AEBAFA2} {3507E59A-4B8B-4418-B1C6-0AD0C2697959} = {9C4A8DA5-024F-48AD-BD57-37FC8AEBAFA2}
{E96488F4-9D4F-4890-A7A0-1085647C82A8} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1} {E96488F4-9D4F-4890-A7A0-1085647C82A8} = {2FF0133A-7AC6-4346-AEC2-CB5C36939AC7}
{7C209DBF-1DB8-4E86-BD78-F689B70D5BD1} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90} {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90}
{A8A58969-B142-4968-982B-16F771A7C805} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90} {A8A58969-B142-4968-982B-16F771A7C805} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90}
{F823B488-2A6B-40C0-B332-65C861DA40E3} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90} {F823B488-2A6B-40C0-B332-65C861DA40E3} = {016CB7CA-D962-4D88-BA4F-FE5A94F35C90}
...@@ -101,6 +103,7 @@ Global ...@@ -101,6 +103,7 @@ Global
{122442B5-0221-43A7-80A3-555E91699951} = {8EEECA2A-3857-4081-A67C-49B9610FE5AE} {122442B5-0221-43A7-80A3-555E91699951} = {8EEECA2A-3857-4081-A67C-49B9610FE5AE}
{430FC82E-16C9-453F-92D3-F4E35F52E0F0} = {E40CD9A8-20E3-4D39-992B-F7DA048E3B4C} {430FC82E-16C9-453F-92D3-F4E35F52E0F0} = {E40CD9A8-20E3-4D39-992B-F7DA048E3B4C}
{E40CD9A8-20E3-4D39-992B-F7DA048E3B4C} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1} {E40CD9A8-20E3-4D39-992B-F7DA048E3B4C} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
{2FF0133A-7AC6-4346-AEC2-CB5C36939AC7} = {7C209DBF-1DB8-4E86-BD78-F689B70D5BD1}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {5B34709A-AE37-4026-9182-CB9C7ADDEAF5} SolutionGuid = {5B34709A-AE37-4026-9182-CB9C7ADDEAF5}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment