-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Valeriy1991/dev
Separate commands with and without results
- Loading branch information
Showing
14 changed files
with
151 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using CQRSlight.Abstract; | ||
using DbConn.DbExecutor.Abstract; | ||
using Ether.Outcomes; | ||
|
||
namespace CQRSlight.Db.Abstract | ||
{ | ||
public abstract class DbCommandWithResult<TResult> : ICommandWithResult<TResult> | ||
{ | ||
protected IDbExecutor DbExecutor { get; } | ||
|
||
protected DbCommandWithResult(IDbExecutor dbExecutor) | ||
{ | ||
if (dbExecutor == null) | ||
throw new ArgumentNullException(nameof(dbExecutor)); | ||
DbExecutor = dbExecutor; | ||
} | ||
|
||
public abstract IOutcome<TResult> Execute(); | ||
} | ||
|
||
public abstract class DbCommandWithResult<TCommandRequest, TResult> : | ||
ICommandWithResult<TCommandRequest, TResult> | ||
{ | ||
protected IDbExecutor DbExecutor { get; } | ||
|
||
protected DbCommandWithResult(IDbExecutor dbExecutor) | ||
{ | ||
if (dbExecutor == null) | ||
throw new ArgumentNullException(nameof(dbExecutor)); | ||
DbExecutor = dbExecutor; | ||
} | ||
|
||
public abstract IOutcome<TResult> Execute(TCommandRequest commandRequest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
using System.Threading.Tasks; | ||
using CQRSlight.Abstract; | ||
using DbConn.DbExecutor.Abstract; | ||
using Ether.Outcomes; | ||
|
||
namespace CQRSlight.Db.Abstract | ||
{ | ||
public abstract class DbCommandWithResultAsync<TResult> : ICommandWithResultAsync<TResult> | ||
{ | ||
protected IDbExecutor DbExecutor { get; } | ||
|
||
protected DbCommandWithResultAsync(IDbExecutor dbExecutor) | ||
{ | ||
if (dbExecutor == null) | ||
throw new ArgumentNullException(nameof(dbExecutor)); | ||
DbExecutor = dbExecutor; | ||
} | ||
|
||
public abstract Task<IOutcome<TResult>> ExecuteAsync(); | ||
} | ||
|
||
public abstract class DbCommandWithResultAsync<TCommandRequest, TResult> : | ||
ICommandWithResultAsync<TCommandRequest, TResult> | ||
{ | ||
protected IDbExecutor DbExecutor { get; } | ||
|
||
protected DbCommandWithResultAsync(IDbExecutor dbExecutor) | ||
{ | ||
if (dbExecutor == null) | ||
throw new ArgumentNullException(nameof(dbExecutor)); | ||
DbExecutor = dbExecutor; | ||
} | ||
|
||
public abstract Task<IOutcome<TResult>> ExecuteAsync(TCommandRequest commandRequest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Ether.Outcomes; | ||
|
||
namespace CQRSlight.Abstract | ||
{ | ||
public interface ICommandWithResult<TResult> | ||
{ | ||
IOutcome<TResult> Execute(); | ||
} | ||
|
||
public interface ICommandWithResult<in TCommandRequest, TResult> | ||
{ | ||
IOutcome<TResult> Execute(TCommandRequest commandRequest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System.Threading.Tasks; | ||
using Ether.Outcomes; | ||
|
||
namespace CQRSlight.Abstract | ||
{ | ||
public interface ICommandWithResultAsync<TResult> | ||
{ | ||
Task<IOutcome<TResult>> ExecuteAsync(); | ||
} | ||
|
||
public interface ICommandWithResultAsync<in TCommandRequest, TResult> | ||
{ | ||
Task<IOutcome<TResult>> ExecuteAsync(TCommandRequest commandRequest); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters