Beispiel #1
0
        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);
        }
Beispiel #2
0
        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"));
        }
Beispiel #3
0
        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);
            }
        }
Beispiel #4
0
 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));
     }
 }
Beispiel #5
0
 public virtual void RegisterServiceGroupFactory(IntPtr groupServiceType, NativeRuntime.IFabricServiceGroupFactory factory)
 {
     throw new NotImplementedException();
 }
Beispiel #6
0
 public virtual NativeCommon.IFabricAsyncOperationContext BeginRegisterServiceGroupFactory(IntPtr groupServiceType, NativeRuntime.IFabricServiceGroupFactory factory, uint timeoutMilliseconds, NativeCommon.IFabricAsyncOperationCallback callback)
 {
     throw new NotImplementedException();
 }