/// <summary>
        /// <para>Asynchronously registers the specified <see cref="System.Fabric.ServiceGroupFactory" /> for the specified service group type with the
        /// specified <paramref name="timeout" /> and <paramref name="cancellationToken" />.</para>
        /// </summary>
        /// <param name="serviceGroupTypeName">
        /// <para>The type name of the ServiceGroup service type (as a string).  This should match the type of the service group type as specified in
        /// the manifests and/or the CreateServiceGroup command.</para>
        /// </param>
        /// <param name="factory">
        /// <para>The <see cref="System.Fabric.ServiceGroupFactory" /> which can create the specified service group type.</para>
        /// </param>
        /// <param name="timeout">
        /// <para>The maximum amount of time Service Fabric will allow this operation to continue before returning a TimeoutException.</para>
        /// </param>
        /// <param name="cancellationToken">
        /// <para>The <see cref="System.Threading.CancellationToken" /> that the operation is observing. It can be used to send a notification that the
        /// operation should be canceled. Note that cancellation is advisory and that the operation may still be completed even if it is canceled.</para>
        /// </param>
        /// <returns>
        /// <para>The task representing the asynchronous operation.</para>
        /// </returns>
        public Task RegisterServiceGroupFactoryAsync(string serviceGroupTypeName, ServiceGroupFactory factory, TimeSpan timeout, CancellationToken cancellationToken)
        {
            this.ThrowIfDisposed();

            FabricRuntime.ValidateParametersForRegisterServiceGroupFactory(serviceGroupTypeName, factory);

            return(this.RegisterServiceGroupFactoryAsyncHelper(serviceGroupTypeName, factory, (uint)timeout.TotalMilliseconds, cancellationToken));
        }
        /// <summary>
        /// <para>Registers the specified <see cref="System.Fabric.ServiceGroupFactory" /> for the specified type.</para>
        /// </summary>
        /// <param name="serviceGroupTypeName">
        /// <para>The type name of the ServiceGroup service type (as a string).  This should match the type of the service group type as specified in the
        /// manifests and/or the CreateServiceGroup command.</para>
        /// </param>
        /// <param name="factory">
        /// <para>The <see cref="System.Fabric.ServiceGroupFactory" /> which can create the specified service group type.</para>
        /// </param>
        public void RegisterServiceGroupFactory(string serviceGroupTypeName, ServiceGroupFactory factory)
        {
            this.ThrowIfDisposed();

            FabricRuntime.ValidateParametersForRegisterServiceGroupFactory(serviceGroupTypeName, factory);

            Utility.WrapNativeSyncInvokeInMTA(() => this.InternalRegisterServiceGroupFactory(serviceGroupTypeName, factory), "FabricRuntime.RegisterServiceGroupFactory");
        }