/// <summary> /// <para>Registers the specified <see cref="System.Fabric.IStatefulServiceFactory" /> for the specified service type.</para> /// </summary> /// <param name="serviceTypeName"> /// <para>The type name of the service type (as a string). This should match the type of the service group type as specified in the manifests /// and/or the CreateService command.</para> /// </param> /// <param name="factory"> /// <para>The <see cref="System.Fabric.IStatefulServiceFactory" /> which can create the specified service type.</para> /// </param> public void RegisterStatefulServiceFactory(string serviceTypeName, IStatefulServiceFactory factory) { this.ThrowIfDisposed(); FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory); Utility.WrapNativeSyncInvokeInMTA(() => this.RegisterServiceFactoryHelper(true, serviceTypeName, factory), "FabricRuntime.RegisterStatefulServiceFactory"); }
/// <summary> /// <para>Registers the specified <see cref="System.Fabric.IStatefulServiceFactory" /> for the specified service type with the specified /// <paramref name="timeout" /> and <paramref name="cancellationToken" />.</para> /// </summary> /// <param name="serviceTypeName"> /// <para>The type name of the service type (as a string). This should match the type of the service group type as specified in the manifests /// and/or the CreateService command.</para> /// </param> /// <param name="factory"> /// <para>The <see cref="System.Fabric.IStatefulServiceFactory" /> which can create the specified service 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 representing the asynchronous operation.</para> /// </returns> public Task RegisterStatefulServiceFactoryAsync(string serviceTypeName, IStatefulServiceFactory factory, TimeSpan timeout, CancellationToken cancellationToken) { this.ThrowIfDisposed(); FabricRuntime.ValidateParametersForRegisterServiceFactory(serviceTypeName, factory); ServiceFactoryBroker broker = new ServiceFactoryBroker(factory, this.codePackageActivationContext); return(this.RegisterServiceFactoryAsyncHelper(true, serviceTypeName, broker, (uint)timeout.TotalMilliseconds, cancellationToken)); }