-
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.
- Loading branch information
Showing
22 changed files
with
144 additions
and
602 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,25 +1,21 @@ | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using NexusAop.Cache; | ||
using NexusAop.Console.Models; | ||
using NexusAop.CustomAspect; | ||
using NexusAop.Console.CustomAspect; | ||
|
||
namespace NexusAop.Console.Service | ||
{ | ||
public interface ITestService | ||
{ | ||
void SayHello(string name); | ||
|
||
[CacheMethod(10)] | ||
int GetBalance( | ||
int id); | ||
|
||
[CacheMethod(20)] | ||
Task<FooEntity> GetFooAsync( | ||
bool isGoodNumber, | ||
CancellationToken cancellationToken = default); | ||
{ | ||
[CustomAspect] | ||
void MyVoidMethod(); | ||
|
||
[CustomAspect] | ||
string MyStringMethod(); | ||
|
||
[CustomAspect] | ||
Task MyMethodTask(); | ||
|
||
[CustomAspect] | ||
Task<string> MyMethodTaskReturnString(); | ||
|
||
[CustomAspect("Property1", "Value1", "Property2", 42, "Property3", true)] | ||
void MyMethod(); | ||
} | ||
} |
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,59 +1,28 @@ | ||
using System; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using NexusAop.Console.Models; | ||
using NexusAop.Console.Repository; | ||
using NexusAop.CustomAspect; | ||
|
||
namespace NexusAop.Console.Service | ||
{ | ||
public class TestService : ITestService | ||
{ | ||
private readonly IFooRepository _fooRepository; | ||
|
||
public TestService( | ||
IFooRepository fooRepository) | ||
{ | ||
public string MyStringMethod() | ||
{ | ||
_fooRepository = fooRepository; | ||
//System.Console.WriteLine("My string method."); | ||
return "My string method."; | ||
} | ||
|
||
public void SayHello( | ||
string name) | ||
public void MyVoidMethod() | ||
{ | ||
if (string.IsNullOrEmpty(name)) | ||
{ | ||
throw new ArgumentNullException(); | ||
} | ||
|
||
System.Console.WriteLine($"Hi {name}"); | ||
|
||
//System.Console.WriteLine("My void method."); | ||
} | ||
|
||
public int GetBalance( | ||
int id) | ||
public async Task MyMethodTask() | ||
{ | ||
System.Console.WriteLine($"Checking id for {id}!"); | ||
var balance = new Random().Next(11111); | ||
Task.Delay(balance).GetAwaiter().GetResult(); | ||
return balance; | ||
//System.Console.WriteLine("MyMethod returns task."); | ||
await Task.CompletedTask; | ||
} | ||
|
||
public async Task<FooEntity> GetFooAsync( | ||
bool isGoodNumber, | ||
CancellationToken cancellationToken = default) | ||
{ | ||
var number = new Random().Next(9000); | ||
await Task.Delay(number, cancellationToken); | ||
var foo = await _fooRepository.GetByIdAsync(2, cancellationToken); | ||
return new FooEntity() | ||
{ | ||
Id = number, | ||
Text = DateTime.Now.ToLongDateString() | ||
}; | ||
} | ||
public void MyMethod() | ||
public async Task<string> MyMethodTaskReturnString() | ||
{ | ||
System.Console.WriteLine("MyMethod has custom aspect properties."); | ||
//System.Console.WriteLine("MyMethod returns Task<string>."); | ||
return "thats ok"; | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.