-
Notifications
You must be signed in to change notification settings - Fork 3
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 #58 from nenoNaninu/support_inheritance
Support inheritance
- Loading branch information
Showing
5 changed files
with
115 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using Microsoft.AspNetCore.SignalR; | ||
using Shared; | ||
|
||
namespace Server.Hubs; | ||
|
||
public class InheritHub : Hub<IUnaryHubReceiver>, IInheritHub | ||
{ | ||
private readonly ILogger<InheritHub> _logger; | ||
|
||
public InheritHub(ILogger<InheritHub> logger) | ||
{ | ||
_logger = logger; | ||
} | ||
|
||
public Task<int> Add(int x, int y) | ||
{ | ||
return Task.FromResult(x + y); | ||
} | ||
|
||
public Task<string> Cat(string x, string y) | ||
{ | ||
return Task.FromResult(x + y); | ||
} | ||
|
||
public Task<UserDefinedType> Echo(UserDefinedType instance) | ||
{ | ||
return Task.FromResult(instance); | ||
} | ||
|
||
public Task<string> Get() | ||
{ | ||
return Task.FromResult("TypedSignalR.Client.DevTools"); | ||
} | ||
} |
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,30 @@ | ||
using System.Threading.Tasks; | ||
using TypedSignalR.Client; | ||
|
||
namespace Shared; | ||
|
||
public interface IHubBaseBase | ||
{ | ||
Task<string> Get(); | ||
} | ||
|
||
public interface IHubBase1 : IHubBaseBase | ||
{ | ||
Task<int> Add(int x, int y); | ||
} | ||
|
||
public interface IHubBase2 : IHubBaseBase | ||
{ | ||
Task<string> Cat(string x, string y); | ||
} | ||
|
||
[Hub] | ||
public interface IInheritHub : IHubBase1, IHubBase2 | ||
{ | ||
Task<UserDefinedType> Echo(UserDefinedType instance); | ||
} | ||
|
||
[Receiver] | ||
public interface IInheritHubReceiver | ||
{ | ||
} |
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