Skip to content

Commit a318191

Browse files
bug fix
1 parent 2c8aeb9 commit a318191

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/ResourceManager/Common/Commands.Common.Strategies/GetAsyncOperation.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ public static async Task<IState> GetAsync<Model>(
1515
where Model : class
1616
{
1717
var context = new AsyncOperationContext(client, cancellationToken);
18-
await context.AddStateAsync(config);
18+
await context.AddStateAsyncResourceBase(config);
1919
return context.Result;
2020
}
2121

22-
static Task AddStateAsync(this AsyncOperationContext context, IResourceBaseConfig config)
22+
static Task AddStateAsyncResourceBase(this AsyncOperationContext context, IResourceBaseConfig config)
2323
=> config.Accept(new AddStateAsyncVisitor(), context);
2424

2525
static async Task AddStateAsync<Model>(this AsyncOperationContext context, ResourceConfig<Model> config)
@@ -45,18 +45,18 @@ static async Task AddStateAsync<Model>(this AsyncOperationContext context, Resou
4545
}
4646
if (info == null)
4747
{
48-
var tasks = config.Dependencies.Select(d => context.AddStateAsync(d));
48+
var tasks = config.Dependencies.Select(d => context.AddStateAsyncResourceBase(d));
4949
await Task.WhenAll(tasks);
5050
return null;
5151
}
5252
return info;
5353
});
5454

5555
static Task AddStateAsync<Model, ParentModel>(
56-
AsyncOperationContext context, NestedResourceConfig<Model, ParentModel> config)
56+
this AsyncOperationContext context, NestedResourceConfig<Model, ParentModel> config)
5757
where Model : class
5858
where ParentModel : class
59-
=> context.AddStateAsync(config.Parent);
59+
=> context.AddStateAsyncResourceBase(config.Parent);
6060

6161
sealed class AddStateAsyncVisitor : IResourceBaseConfigVisitor<AsyncOperationContext, Task>
6262
{

src/ResourceManager/Common/Commands.Common.Strategies/IState.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ public static Model Get<Model, ParentModel>(
1717
this IState state, NestedResourceConfig<Model, ParentModel> config)
1818
where Model : class
1919
where ParentModel : class
20-
=> config.Strategy.Get(state.Get(config.Parent), config.Name);
20+
=> config.Strategy.Get(state.GetResourceBase(config.Parent), config.Name);
2121

22-
public static Model Get<Model>(
22+
public static Model GetResourceBase<Model>(
2323
this IState state, IResourceBaseConfig<Model> config)
2424
where Model : class
2525
=> config.Accept(new GetVisitor<Model>(), state);

src/ResourceManager/Common/Commands.Common.Strategies/State.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public Model Get<Model>(ResourceConfig<Model> config)
1111

1212
public Model GetOrAdd<Model>(ResourceConfig<Model> config, Func<Model> f)
1313
where Model : class
14-
=> Map.GetOrNull(config.DefaultIdStr()) as Model;
14+
=> Map.GetOrAdd(config.DefaultIdStr(), _ => f()) as Model;
1515

1616
public bool Contains(IResourceBaseConfig config)
1717
=> Map.ContainsKey(config.DefaultIdStr());

0 commit comments

Comments
 (0)