-
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.
Introduces recipient Id and RecipientDescription (#19)
- Loading branch information
Showing
22 changed files
with
282 additions
and
146 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
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 |
---|---|---|
@@ -1,27 +1,9 @@ | ||
using System; | ||
|
||
namespace NScatterGather | ||
namespace NScatterGather | ||
{ | ||
public class IncompleteInvocation | ||
public class IncompleteInvocation : Invocation | ||
{ | ||
public string? RecipientName { get; } | ||
|
||
public Type? RecipientType { get; } | ||
|
||
internal IncompleteInvocation( | ||
string? recipientName, | ||
Type? recipientType) | ||
internal IncompleteInvocation(RecipientDescription recipient) : base(recipient) | ||
{ | ||
RecipientName = recipientName; | ||
RecipientType = recipientType; | ||
} | ||
|
||
public void Deconstruct( | ||
out string? recipientName, | ||
out Type? recipientType) | ||
{ | ||
recipientName = RecipientName; | ||
recipientType = RecipientType; | ||
} | ||
} | ||
} |
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,12 @@ | ||
namespace NScatterGather | ||
{ | ||
public abstract class Invocation | ||
{ | ||
public RecipientDescription Recipient { get; } | ||
|
||
protected Invocation(RecipientDescription recipient) | ||
{ | ||
Recipient = recipient; | ||
} | ||
} | ||
} |
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,45 @@ | ||
using System; | ||
|
||
namespace NScatterGather | ||
{ | ||
public class RecipientDescription | ||
{ | ||
public Guid Id { get; } | ||
|
||
public string? Name { get; } | ||
|
||
public Type? Type { get; } | ||
|
||
public Lifetime Lifetime { get; } | ||
|
||
public CollisionStrategy CollisionStrategy { get; } | ||
|
||
internal RecipientDescription( | ||
Guid id, | ||
string? name, | ||
Type? type, | ||
Lifetime lifetime, | ||
CollisionStrategy collisionStrategy) | ||
{ | ||
Id = id; | ||
Name = name; | ||
Type = type; | ||
Lifetime = lifetime; | ||
CollisionStrategy = collisionStrategy; | ||
} | ||
|
||
public void Deconstruct( | ||
out Guid id, | ||
out string? name, | ||
out Type? type, | ||
out Lifetime lifetime, | ||
out CollisionStrategy collisionStrategy) | ||
{ | ||
id = Id; | ||
name = Name; | ||
type = Type; | ||
lifetime = Lifetime; | ||
collisionStrategy = CollisionStrategy; | ||
} | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/NScatterGather/Invocations/RecipientDescriptionFactory.cs
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,21 @@ | ||
using NScatterGather.Recipients; | ||
|
||
namespace NScatterGather.Invocations | ||
{ | ||
internal class RecipientDescriptionFactory | ||
{ | ||
public static RecipientDescription CreateFrom(Recipient recipient) | ||
{ | ||
var recipientType = recipient is TypeRecipient ir ? ir.Type : null; | ||
|
||
var description = new RecipientDescription( | ||
recipient.Id, | ||
recipient.Name, | ||
recipientType, | ||
recipient.Lifetime, | ||
recipient.CollisionStrategy); | ||
|
||
return description; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.