Skip to content

Commit 73c300f

Browse files
committed
Fixed naming
1 parent b6f28d1 commit 73c300f

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

DecoratorPattern/CachedRepository.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ public CachedRepository(IMemoryCache memoryCache, IRepository repository)
1313
_repository = repository;
1414
}
1515

16-
public async Task<Person> GetPersonById(int id)
16+
public async Task<Person> GetPersonByIdAsync(int id)
1717
{
1818
if (!_memoryCache.TryGetValue(id, out Person value))
1919
{
20-
value = await _repository.GetPersonById(id);
20+
value = await _repository.GetPersonByIdAsync(id);
2121
_memoryCache.Set(id, value);
2222
}
2323

DecoratorPattern/DecoratorPattern.sln

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecoratorPattern", "DecoratorPattern.csproj", "{56D318E6-37DA-46A7-AE04-533A1254FE75}"
3+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DecoratorPattern", "DecoratorPattern.csproj", "{BCE46AF5-03BC-4FD3-88C6-3C5C5A5C3908}"
44
EndProject
55
Global
66
GlobalSection(SolutionConfigurationPlatforms) = preSolution
77
Debug|Any CPU = Debug|Any CPU
88
Release|Any CPU = Release|Any CPU
99
EndGlobalSection
1010
GlobalSection(ProjectConfigurationPlatforms) = postSolution
11-
{56D318E6-37DA-46A7-AE04-533A1254FE75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12-
{56D318E6-37DA-46A7-AE04-533A1254FE75}.Debug|Any CPU.Build.0 = Debug|Any CPU
13-
{56D318E6-37DA-46A7-AE04-533A1254FE75}.Release|Any CPU.ActiveCfg = Release|Any CPU
14-
{56D318E6-37DA-46A7-AE04-533A1254FE75}.Release|Any CPU.Build.0 = Release|Any CPU
11+
{BCE46AF5-03BC-4FD3-88C6-3C5C5A5C3908}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
12+
{BCE46AF5-03BC-4FD3-88C6-3C5C5A5C3908}.Debug|Any CPU.Build.0 = Debug|Any CPU
13+
{BCE46AF5-03BC-4FD3-88C6-3C5C5A5C3908}.Release|Any CPU.ActiveCfg = Release|Any CPU
14+
{BCE46AF5-03BC-4FD3-88C6-3C5C5A5C3908}.Release|Any CPU.Build.0 = Release|Any CPU
1515
EndGlobalSection
1616
EndGlobal

DecoratorPattern/IRepository.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
public interface IRepository
44
{
5-
public Task<Person> GetPersonById(int id);
5+
public Task<Person> GetPersonByIdAsync(int id);
66

77
public Task SavePersonAsync(Person person);
88
}

DecoratorPattern/Program.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
await repository.SavePersonAsync(person);
2121

2222
var stopwatch = Stopwatch.StartNew();
23-
await repository.GetPersonById(1);
23+
await repository.GetPersonByIdAsync(1);
2424
Console.WriteLine($"First call took {stopwatch.ElapsedMilliseconds} ms");
2525

2626
stopwatch.Restart();
27-
await repository.GetPersonById(1);
27+
await repository.GetPersonByIdAsync(1);
2828
Console.WriteLine($"Second call took {stopwatch.ElapsedMilliseconds} ms");

DecoratorPattern/SlowRepository.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public class SlowRepository : IRepository
44
{
55
private readonly List<Person> _people = new();
66

7-
public async Task<Person> GetPersonById(int id)
7+
public async Task<Person> GetPersonByIdAsync(int id)
88
{
99
await Task.Delay(1000);
1010
return _people.Single(p => p.Id == id);

0 commit comments

Comments
 (0)