private NativeRuntime.IFabricServiceGroupFactory CreateServiceGroupFactoryHelper(ServiceGroupFactory factory) { NativeRuntime.IFabricServiceGroupFactoryBuilder nativeBuilder = this.NativeRuntimeObject.CreateServiceGroupFactoryBuilder(); foreach (var namedFactory in factory.StatefulServiceFactories) { ServiceFactoryBroker broker = new ServiceFactoryBroker(namedFactory.Item2, this.codePackageActivationContext); using (var pin = new PinBlittable(namedFactory.Item1)) { nativeBuilder.AddStatefulServiceFactory(pin.AddrOfPinnedObject(), broker as NativeRuntime.IFabricStatefulServiceFactory); } } foreach (var namedFactory in factory.StatelessServiceFactories) { ServiceFactoryBroker broker = new ServiceFactoryBroker(namedFactory.Item2, this.codePackageActivationContext); using (var pin = new PinBlittable(namedFactory.Item1)) { nativeBuilder.AddStatelessServiceFactory(pin.AddrOfPinnedObject(), broker as NativeRuntime.IFabricStatelessServiceFactory); } } NativeRuntime.IFabricServiceGroupFactory serviceGroupFactory = nativeBuilder.ToServiceGroupFactory(); return(serviceGroupFactory); }
private Task RegisterServiceGroupFactoryAsyncHelper(string serviceGroupTypeName, ServiceGroupFactory factory, uint timeoutMs, CancellationToken cancellationToken) { NativeRuntime.IFabricServiceGroupFactory serviceGroupFactory = this.CreateServiceGroupFactoryHelper(factory); return(Utility.WrapNativeAsyncInvokeInMTA( (callback) => this.RegisterServiceGroupFactoryBeginWrapper(serviceGroupTypeName, serviceGroupFactory, timeoutMs, callback), this.RegisterServiceGroupFactoryEndWrapper, cancellationToken, "FabricRuntime.RegisterServiceGroupFactory")); }
private void InternalRegisterServiceGroupFactory(string serviceGroupType, ServiceGroupFactory serviceGroupFactory) { //// Calls native code, requires UnmanagedCode permission NativeRuntime.IFabricServiceGroupFactory nativeFactory = this.CreateServiceGroupFactoryHelper(serviceGroupFactory); using (var pin = new PinBlittable(serviceGroupType)) { this.NativeRuntimeObject.RegisterServiceGroupFactory(pin.AddrOfPinnedObject(), nativeFactory); } }
private NativeCommon.IFabricAsyncOperationContext RegisterServiceGroupFactoryBeginWrapper(string serviceGroupTypeName, NativeRuntime.IFabricServiceGroupFactory factory, uint timeoutMs, NativeCommon.IFabricAsyncOperationCallback callback) { using (var pin = new PinBlittable(serviceGroupTypeName)) { return(this.NativeRuntimeObject.BeginRegisterServiceGroupFactory(pin.AddrOfPinnedObject(), factory, timeoutMs, callback)); } }
public virtual void RegisterServiceGroupFactory(IntPtr groupServiceType, NativeRuntime.IFabricServiceGroupFactory factory) { throw new NotImplementedException(); }
public virtual NativeCommon.IFabricAsyncOperationContext BeginRegisterServiceGroupFactory(IntPtr groupServiceType, NativeRuntime.IFabricServiceGroupFactory factory, uint timeoutMilliseconds, NativeCommon.IFabricAsyncOperationCallback callback) { throw new NotImplementedException(); }