Skip to content

Commit 1eca5d0

Browse files
author
pmosk
committed
Use .NET8 features
1 parent 46e5d94 commit 1eca5d0

File tree

18 files changed

+85
-164
lines changed

18 files changed

+85
-164
lines changed

src/app/AzureFunc/AzureFunc.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
<PackageReference Include="GarageGroup.Infra.Dataverse.Api" Version="3.12.0" />
4040
<PackageReference Include="GarageGroup.Infra.Dataverse.DataverseUser.Api" Version="1.3.0" />
4141
<PackageReference Include="GarageGroup.Infra.Http.Polly" Version="1.1.1" />
42-
<PackageReference Include="GarageGroup.Infra.Sql.Api" Version="2.0.0" />
43-
<PackageReference Include="GarageGroup.Infra.Sql.Api.Provider.Microsoft" Version="2.0.0" />
42+
<PackageReference Include="GarageGroup.Infra.Sql.Api" Version="2.1.0" />
43+
<PackageReference Include="GarageGroup.Infra.Sql.Api.Provider.Microsoft" Version="2.1.0" />
4444
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.11.0" OutputItemType="Analyzer" />
4545
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
4646
<PackageReference Include="PrimeFuncPack.DependencyRegistry" Version="1.2.1" />

src/endpoint/Incident.Create/Flow/Flow.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<PackageReference Include="GarageGroup.Infra.Bot.Builder.ChatFlow.Extensions" Version="0.3.0" />
2424
<PackageReference Include="GarageGroup.Infra.Bot.Builder.ChatFlow.Step.Card" Version="0.2.0" />
2525
<PackageReference Include="GarageGroup.Infra.Bot.Builder.ChatFlow.Step.Lookup" Version="0.2.0" />
26-
<PackageReference Include="GarageGroup.Infra.Bot.Builder.ChatFlow.Step.Value" Version="0.2.0" />
26+
<PackageReference Include="GarageGroup.Infra.Bot.Builder.ChatFlow.Step.Value" Version="0.2.1" />
2727
<PackageReference Include="PrimeFuncPack.Dependency.Core" Version="2.0.2" />
2828
<PackageReference Include="PrimeFuncPack.Primitives.Pipeline" Version="2.0.2" />
2929
</ItemGroup>

src/endpoint/Incident.Create/Flow/Step.CreateIncident/IncidentCreateHelper.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,8 @@ internal static ValueTask<ChatFlowJump<IncidentCreateOut>> CreateIncidentOrBeakA
4343
title: flowState.Title.OrEmpty(),
4444
description: flowState.Description,
4545
caseTypeCode: flowState.CaseTypeCode,
46-
priorityCode: flowState.PriorityCode)
47-
{
48-
CallerUserId = flowState.BotUserId
49-
})
46+
priorityCode: flowState.PriorityCode,
47+
callerUserId: flowState.BotUserId.GetValueOrDefault()))
5048
.PipeValue(
5149
crmIncidentApi.CreateAsync)
5250
.MapFailure(

src/service/CrmContact/Api/Api.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<PackageReference Include="GarageGroup.Infra.Dataverse.Api.Abstractions.Search" Version="3.8.2" />
2020
<PackageReference Include="GarageGroup.Infra.Dataverse.Api.Filter" Version="0.1.1" />
2121
<PackageReference Include="GarageGroup.Infra.Sql.Api.Abstractions.QueryEntitySet" Version="2.0.0" />
22-
<PackageReference Include="GarageGroup.Infra.Sql.Api.Core.DbRequest" Version="2.0.0" />
22+
<PackageReference Include="GarageGroup.Infra.Sql.Api.Core.DbRequest" Version="2.1.0" />
2323
<PackageReference Include="PrimeFuncPack.Core.Optional" Version="2.1.0" />
2424
<PackageReference Include="PrimeFuncPack.Dependency.Core" Version="2.0.2" />
2525
</ItemGroup>

src/service/CrmContact/Api/Api/CrmCustomerApi.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,11 @@
33

44
namespace GarageGroup.Internal.Support;
55

6-
internal sealed partial class CrmContactApi : ICrmContactApi
6+
internal sealed partial class CrmContactApi(IDataverseSearchSupplier dataverseApi, ISqlQueryEntitySetSupplier sqlApi) : ICrmContactApi
77
{
88
private static readonly FlatArray<string> ContactSetSearchEntities;
99

1010
static CrmContactApi()
1111
=>
1212
ContactSetSearchEntities = new("contact");
13-
14-
private readonly IDataverseSearchSupplier dataverseApi;
15-
16-
private readonly ISqlQueryEntitySetSupplier sqlApi;
17-
18-
internal CrmContactApi(IDataverseSearchSupplier dataverseApi, ISqlQueryEntitySetSupplier sqlApi)
19-
{
20-
this.dataverseApi = dataverseApi;
21-
this.sqlApi = sqlApi;
22-
}
2313
}

src/service/CrmCustomer/Api/Api.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<PackageReference Include="EarlyFuncPack.Core.AsyncPipeline" Version="0.3.0" />
1919
<PackageReference Include="GarageGroup.Infra.Dataverse.Api.Abstractions.Search" Version="3.8.2" />
2020
<PackageReference Include="GarageGroup.Infra.Sql.Api.Abstractions.QueryEntitySet" Version="2.0.0" />
21-
<PackageReference Include="GarageGroup.Infra.Sql.Api.Core.DbRequest" Version="2.0.0" />
21+
<PackageReference Include="GarageGroup.Infra.Sql.Api.Core.DbRequest" Version="2.1.0" />
2222
<PackageReference Include="PrimeFuncPack.Core.Optional" Version="2.1.0" />
2323
<PackageReference Include="PrimeFuncPack.Dependency.Core" Version="2.0.2" />
2424
</ItemGroup>

src/service/CrmCustomer/Api/Api/CrmCustomerApi.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,11 @@
33

44
namespace GarageGroup.Internal.Support;
55

6-
internal sealed partial class CrmCustomerApi : ICrmCustomerApi
6+
internal sealed partial class CrmCustomerApi(IDataverseSearchSupplier dataverseApi, ISqlQueryEntitySetSupplier sqlApi) : ICrmCustomerApi
77
{
88
private static readonly FlatArray<string> CustomerSetSearchEntities;
99

1010
static CrmCustomerApi()
1111
=>
1212
CustomerSetSearchEntities = new("account");
13-
14-
private readonly IDataverseSearchSupplier dataverseApi;
15-
16-
private readonly ISqlQueryEntitySetSupplier sqlApi;
17-
18-
internal CrmCustomerApi(IDataverseSearchSupplier dataverseApi, ISqlQueryEntitySetSupplier sqlApi)
19-
{
20-
this.dataverseApi = dataverseApi;
21-
this.sqlApi = sqlApi;
22-
}
2313
}

src/service/CrmIncident/Api/Api/Api.Create.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
namespace GarageGroup.Internal.Support;
77

8-
partial class CrmIncidentApi<TDataverseApi>
8+
partial class CrmIncidentApi
99
{
1010
public ValueTask<Result<IncidentCreateOut, Failure<IncidentCreateFailureCode>>> CreateAsync(
1111
IncidentCreateIn input, CancellationToken cancellationToken)
@@ -38,7 +38,7 @@ public ValueTask<Result<IncidentCreateOut, Failure<IncidentCreateFailureCode>>>
3838
.Pipe(
3939
IncidentJsonCreateIn.BuildDataverseCreateInput)
4040
.PipeValue(
41-
GetDataverseApi(input.CallerUserId).CreateEntityAsync<IncidentJsonCreateIn, IncidentJsonCreateOut>)
41+
dataverseApi.Impersonate(input.CallerUserId).CreateEntityAsync<IncidentJsonCreateIn, IncidentJsonCreateOut>)
4242
.MapFailure(
4343
static failure => failure.MapFailureCode(ToIncidentCreateFailureCode))
4444
.MapSuccess(
Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
using System;
2-
using GarageGroup.Infra;
1+
using GarageGroup.Infra;
32

43
namespace GarageGroup.Internal.Support;
54

6-
internal sealed partial class CrmIncidentApi<TDataverseApi> : ICrmIncidentApi
7-
where TDataverseApi : IDataverseEntityCreateSupplier, IDataverseImpersonateSupplier<IDataverseEntityCreateSupplier>
8-
{
9-
private readonly TDataverseApi dataverseApi;
10-
11-
internal CrmIncidentApi(TDataverseApi dataverseApi)
12-
=>
13-
this.dataverseApi = dataverseApi;
5+
using TDataverseApi = IDataverseImpersonateSupplier<IDataverseEntityCreateSupplier>;
146

15-
private IDataverseEntityCreateSupplier GetDataverseApi(Guid? callerUserId)
16-
=>
17-
callerUserId switch
18-
{
19-
null => dataverseApi,
20-
_ => dataverseApi.Impersonate(callerUserId.Value)
21-
};
7+
internal sealed partial class CrmIncidentApi(TDataverseApi dataverseApi) : ICrmIncidentApi
8+
{
229
}

src/service/CrmIncident/Api/CrmIncidentApiDependency.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ namespace GarageGroup.Internal.Support;
1010
public static class CrmIncidentApiDependency
1111
{
1212
public static Dependency<ICrmIncidentApi> UseCrmIncidentApi<TDataverseApi>(this Dependency<TDataverseApi> dependency)
13-
where TDataverseApi : IDataverseEntityCreateSupplier, IDataverseImpersonateSupplier<IDataverseEntityCreateSupplier>
13+
where TDataverseApi : IDataverseImpersonateSupplier<IDataverseEntityCreateSupplier>
1414
{
1515
ArgumentNullException.ThrowIfNull(dependency);
1616
return dependency.Map<ICrmIncidentApi>(CreateApi);
1717

18-
static CrmIncidentApi<TDataverseApi> CreateApi(TDataverseApi dataverseApi)
18+
static CrmIncidentApi CreateApi(TDataverseApi dataverseApi)
1919
{
2020
ArgumentNullException.ThrowIfNull(dataverseApi);
2121
return new(dataverseApi);

0 commit comments

Comments
 (0)