Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated to use the new DataverseClient and targeting .net standard 2.0 #52

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions v9.2/Client/Enums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Microsoft.Pfe.Xrm
{
public enum CrmOnlineRegion
{
NA,
EMEA,
APAC
}

public enum XrmServiceType
{
Organization,
OrganizationWeb,
OrganizationData
}
}
31 changes: 31 additions & 0 deletions v9.2/Client/ILocalResults.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*================================================================================================================================

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.

THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object
code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the
Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims
or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.

=================================================================================================================================*/
namespace Microsoft.Pfe.Xrm
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;

using Microsoft.Xrm.Sdk;

public interface ILocalResults<TResult, TFailure>
where TFailure : IParallelOperationFailure
{
IList<TResult> Results { get; }
IList<TFailure> Failures { get; }
}
}
90 changes: 90 additions & 0 deletions v9.2/Client/ParallelOperationContext.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*================================================================================================================================

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.

THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object
code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the
Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims
or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.

=================================================================================================================================*/
namespace Microsoft.Pfe.Xrm
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Text;
using Microsoft.PowerPlatform.Dataverse.Client;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;

/// <summary>
/// A parallel operation context object that maintains a reference to a Organization.svc channel
/// </summary>
/// <typeparam name="TResponse">The expected response type to collect</typeparam>
/// <remarks>
/// ASSUMPTION: The local reference temporarily points to a threadlocal instance shared across partitions, thus we do not dispose from the context directly
/// </remarks>
internal sealed class ParallelOrganizationOperationContext<TRequest, TResponse> : ParallelOperationContext<ServiceClient, TResponse, ParallelOrganizationOperationFailure<TRequest>>
{
public ParallelOrganizationOperationContext() { }

public ParallelOrganizationOperationContext(ServiceClient proxy)
: base(proxy) { }
}

/// <summary>
/// A context object can be passed between iterations of a parallelized process partition
/// Maintains a reference to a ThreadLocal<OrganizationServiceProxy>.Value and
/// implements ILocalResults<TResponse> for collecting partitioned results in parallel operations
/// </summary>
/// <typeparam name="TResponse">The expected response type to collect</typeparam>
internal class ParallelOperationContext<TLocal, TResponse, TFailure> : ILocalResults<TResponse, TFailure>
where TFailure : IParallelOperationFailure
{
protected ParallelOperationContext() { }

public ParallelOperationContext(TLocal local) { this.Local = local; }

public TLocal Local { get; set; }

#region ILocalResults<TResponse> Members

private IList<TResponse> results;
public IList<TResponse> Results
{
get
{
if (this.results == null)
{
this.results = new List<TResponse>();
}

return this.results;
}
}

private IList<TFailure> failures;

public IList<TFailure> Failures
{
get
{
if (this.failures == null)
{
this.failures = new List<TFailure>();
}

return this.failures;
}
}

#endregion
}
}
55 changes: 55 additions & 0 deletions v9.2/Client/ParallelOperationFailure.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*================================================================================================================================

This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.

THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.

We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object
code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market Your software
product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product in which the
Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against any claims
or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code.

=================================================================================================================================*/
namespace Microsoft.Pfe.Xrm
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Xrm.Sdk;


/// <summary>
/// Represents an <see cref="IOrganizationService"/> operation failure during parallel execution
/// </summary>
/// <typeparam name="TRequest">The originating request type</typeparam>
internal class ParallelOrganizationOperationFailure<TRequest> : ParallelOperationFailure<TRequest, OrganizationServiceFault>
{
public ParallelOrganizationOperationFailure(TRequest request, FaultException<OrganizationServiceFault> fault)
: base(request, fault) { }
}

/// <summary>
/// Represents a service operation failure during parallel execution
/// </summary>
/// <typeparam name="TRequest">The originating request type</typeparam>
/// <typeparam name="TFault">The fault type representing the failure event</typeparam>
internal class ParallelOperationFailure<TRequest, TFault> : IParallelOperationFailure
where TFault : BaseServiceFault
{
public ParallelOperationFailure(TRequest request, FaultException<TFault> exception)
{
this.Request = request;
this.Exception = exception;
}

public TRequest Request { get; set; }
public FaultException<TFault> Exception { get; set; }
}

public interface IParallelOperationFailure { }
}
Loading