Skip to content

Commit

Permalink
Merge pull request #378 from microsoft/release/update/230608071627
Browse files Browse the repository at this point in the history
''
  • Loading branch information
MattB-msft authored Jun 8, 2023
2 parents 44a1af6 + 527ebae commit 4a44cfa
Show file tree
Hide file tree
Showing 29 changed files with 4,111 additions and 202 deletions.
2 changes: 1 addition & 1 deletion src/Build.Common.core.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(ProjectSpecificFx)' == ''">
<TargetFrameworks>net462;net472;net48;netcoreapp3.1;netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>net462;net472;net48;netstandard2.0;net6.0</TargetFrameworks>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>

Expand Down
9 changes: 5 additions & 4 deletions src/Build.Shared.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<PackageVersion_Adal>3.19.8</PackageVersion_Adal>
<PackageVersion_MSAL>4.35.1</PackageVersion_MSAL>
<PackageVersion_CdsSdk>4.9.665-v9.0-master</PackageVersion_CdsSdk>
<PackageVersion_CrmProxy>4.9.665-v9.0-master</PackageVersion_CrmProxy>
<PackageVersion_CdsSdk>4.9.3165-v9.0-weekly-2304.2</PackageVersion_CdsSdk>
<PackageVersion_CrmProxy>4.9.3165-v9.0-weekly-2304.2</PackageVersion_CrmProxy>
<PackageVersion_CDSServerNuget>4.6.6061-weekly-2108.5</PackageVersion_CDSServerNuget>
<PackageVersion_Newtonsoft>13.0.1</PackageVersion_Newtonsoft>
<PackageVersion_RestClientRuntime>2.3.20</PackageVersion_RestClientRuntime>
<PackageVersion_XrmSdk>9.0.2.45</PackageVersion_XrmSdk>
<PackageVersion_XrmSdk>9.0.2.48</PackageVersion_XrmSdk>
<PackageVersion_Dep_OutlookXrmSdk>9.0.2.34</PackageVersion_Dep_OutlookXrmSdk>
<PackageVersion_BatchedTelemetry>3.0.5</PackageVersion_BatchedTelemetry>
<PackageVersion_BatchedTelemetry>3.0.8</PackageVersion_BatchedTelemetry>
<PackageVersion_DataverseClient>0.4.20</PackageVersion_DataverseClient>
<PackageVersion_CoverletCollector>3.1.0</PackageVersion_CoverletCollector>
<PackageVersion_Microsoft_Extensions>3.1.8</PackageVersion_Microsoft_Extensions>
<PackageVersion_SystemRuntime>6.0.0</PackageVersion_SystemRuntime>

<!-- Test: -->
<PackageVersion_MicrosoftNETTestSdk>17.5.0</PackageVersion_MicrosoftNETTestSdk>
Expand Down
23 changes: 13 additions & 10 deletions src/GeneralTools/DataverseClient/Client/BatchManager.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Messages;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics;

namespace Microsoft.PowerPlatform.Dataverse.Client
{
Expand Down Expand Up @@ -34,22 +35,24 @@ internal sealed class BatchManager
/// </summary>
private DataverseTraceLogger logger = null;

#endregion
#endregion

/// <summary>
/// Base Constructor..
/// </summary>
/// <param name="MaxBatches">Max number of concurrent batches possible</param>
/// <param name="MaxRequestPerBatch">Max number of requests per Batch</param>
/// <param name="traceLogger">TraceLogger</param>
public BatchManager(DataverseTraceLogger traceLogger, int MaxBatches = 50000, int MaxRequestPerBatch = 5000)
/// <summary>
/// Base Constructor..
/// </summary>
/// <param name="MaxBatches">Max number of concurrent batches possible</param>
/// <param name="MaxRequestPerBatch">Max number of requests per Batch</param>
/// <param name="IsClonedConnection">Indicates if the connection is being cloned</param>
/// <param name="traceLogger">TraceLogger</param>
public BatchManager(DataverseTraceLogger traceLogger, int MaxBatches = 50000, int MaxRequestPerBatch = 5000, bool IsClonedConnection = false)
{
logger = traceLogger;
// Do a Version Check here?
MaxNumberOfBatches = MaxBatches;
MaxNumberOfRequestsInABatch = MaxRequestPerBatch;
RequestBatches = new Dictionary<Guid, RequestBatch>();
logger.Log(string.Format(CultureInfo.InvariantCulture, "New Batch Manager Created, Max #of Batches:{0}, Max #of RequestsPerBatch:{1}", MaxBatches, MaxRequestPerBatch), System.Diagnostics.TraceEventType.Verbose);
if (!IsClonedConnection)
logger.Log(string.Format(CultureInfo.InvariantCulture, "New Batch Manager Created, Max #of Batches:{0}, Max #of RequestsPerBatch:{1}", MaxBatches, MaxRequestPerBatch), TraceEventType.Verbose);
}

/// <summary>
Expand Down
116 changes: 75 additions & 41 deletions src/GeneralTools/DataverseClient/Client/ConnectionService.cs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,212 @@
#pragma warning disable CS1591

using Microsoft.Xrm.Sdk;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Microsoft.PowerPlatform.Dataverse.Client.Extensions
{
public class AsyncStatusResponse
{
/// <summary>
/// Status of the system job.
/// </summary>
public enum AsyncStatusResponse_statecode
{
Ready = 0,
Suspended = 1,
Locked = 2,
Completed = 3,
FailedParse = 999
}

/// <summary>
/// Reason for the status of the system job.
/// </summary>
public enum AsyncStatusResponse_statuscode
{
WaitingForResources = 0,
Waiting = 10,
InProgress = 20,
Pausing = 21,
Canceling = 22,
Succeeded = 30,
Failed = 31,
Canceled = 32,
FailedParse = 999
}

/// <summary>
/// Raw entity returned from the operation status poll.
/// </summary>
public Entity RetrievedEntity { get; set; }

/// <summary>
/// Operation Id.
/// </summary>
public Guid AsyncOperationId
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Id;
else
return Guid.Empty;
}
}

/// <summary>
/// Name of the Operation
/// </summary>
public string OperationName
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("name") ? RetrievedEntity.GetAttributeValue<string>("name") : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// Type of the Operation <see href="https://learn.microsoft.com/power-apps/developer/data-platform/reference/entities/asyncoperation#operationtype-choicesoptions"/>
/// </summary>
public string OperationType
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("operationtype") ? RetrievedEntity.FormattedValues["operationtype"] : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// User readable message, if available.
/// </summary>
public string FriendlyMessage
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("friendlymessage") ? RetrievedEntity.GetAttributeValue<string>("friendlymessage") : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// System message, if available
/// </summary>
public string Message
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("message") ? RetrievedEntity.GetAttributeValue<string>("message") : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// Correlation id
/// </summary>
public Guid CorrlationId
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("correlationid") ? RetrievedEntity.GetAttributeValue<Guid>("correlationid") : Guid.Empty;
else
return Guid.Empty;
}
}

/// <summary>
/// Operation Status Code.
/// </summary>
public AsyncStatusResponse_statuscode StatusCode { get; internal set; }

/// <summary>
/// Localized text version of Status code, if available
/// </summary>
public string StatusCode_Localized {
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("statuscode") ? RetrievedEntity.FormattedValues["statuscode"] : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// Operation State code
/// </summary>
public AsyncStatusResponse_statecode State { get; internal set; }

/// <summary>
/// Localized text version of state code text, if available
/// </summary>
public string State_Localized
{
get
{
if (RetrievedEntity != null)
return RetrievedEntity.Attributes.ContainsKey("statecode") ? RetrievedEntity.FormattedValues["statecode"] : string.Empty;
else
return string.Empty;
}
}

/// <summary>
/// Creates an AsyncStatusResponse Object
/// </summary>
/// <param name="asyncOperationResponses"></param>
internal AsyncStatusResponse(EntityCollection asyncOperationResponses)
{
// parse the Async Operation type.
if (asyncOperationResponses == null)
{
// Do something Result is null.

}
else if ( asyncOperationResponses != null && !asyncOperationResponses.Entities.Any()) {
// Do something ( no records )
}else
{
// not null and have records.
this.RetrievedEntity = asyncOperationResponses.Entities.First(); // get first entity.
// Parse state and status
OptionSetValue ostatecode = RetrievedEntity.Attributes.ContainsKey("statecode") ? RetrievedEntity.GetAttributeValue<OptionSetValue>("statecode") : new OptionSetValue(-1);
try
{
State = (AsyncStatusResponse_statecode)ostatecode.Value;
}
catch
{
State = AsyncStatusResponse_statecode.FailedParse;
}

OptionSetValue ostatuscode = RetrievedEntity.Attributes.ContainsKey("statuscode") ? RetrievedEntity.GetAttributeValue<OptionSetValue>("statuscode") : new OptionSetValue(-1);
try
{
StatusCode = (AsyncStatusResponse_statuscode)ostatuscode.Value;
}
catch
{
StatusCode = AsyncStatusResponse_statuscode.FailedParse;
}

}
}

}
}
#pragma warning restore CS1591
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<PackageReference Include="System.Security.Cryptography.Algorithms" Version="4.3.1" />
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="4.7.0" />
<PackageReference Include="System.Security.Permissions" Version="5.0.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.10.0" />
<PackageReference Include="System.ServiceModel.Http" Version="4.10.2" />
<PackageReference Include="System.Text.Json" Version="6.0.7" />
<PackageReference Include="Microsoft.Identity.Client.Extensions.Msal" Version="2.18.9" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="$(PackageVersion_Microsoft_Extensions)" />
Expand Down
Loading

0 comments on commit 4a44cfa

Please sign in to comment.