コード例 #1
0
        internal static unsafe ServicePlacementPolicyDescription CreateFromNative(IntPtr nativePtr)
        {
            ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer);

            NativeTypes.FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION *casted = (NativeTypes.FABRIC_SERVICE_PLACEMENT_POLICY_DESCRIPTION *)nativePtr;
            switch (casted->Type)
            {
            case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN:
                return(ServicePlacementInvalidDomainPolicyDescription.CreateFromNative(casted->Value));

            case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN:
                return(ServicePlacementRequiredDomainPolicyDescription.CreateFromNative(casted->Value));

            case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_PREFERRED_PRIMARY_DOMAIN:
                return(ServicePlacementPreferPrimaryDomainPolicyDescription.CreateFromNative(casted->Value));

            case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_REQUIRED_DOMAIN_DISTRIBUTION:
                return(ServicePlacementRequireDomainDistributionPolicyDescription.CreateFromNative(casted->Value));

            case NativeTypes.FABRIC_PLACEMENT_POLICY_TYPE.FABRIC_PLACEMENT_POLICY_NONPARTIALLY_PLACE_SERVICE:
                return(ServicePlacementNonPartiallyPlaceServicePolicyDescription.CreateFromNative(casted->Value));

            default:
                AppTrace.TraceSource.WriteError("ServicePlacementPolicyDescription.CreateFromNative", "Invalid placement policy type {0}", casted->Type);
                break;
            }
            return(null);
        }
コード例 #2
0
        internal ServicePlacementPolicyDescription GetCopy()
        {
            ServicePlacementPolicyDescription copy;

            if (this is ServicePlacementInvalidDomainPolicyDescription)
            {
                copy = new ServicePlacementInvalidDomainPolicyDescription(this as ServicePlacementInvalidDomainPolicyDescription);
            }
            else if (this is ServicePlacementRequiredDomainPolicyDescription)
            {
                copy = new ServicePlacementRequiredDomainPolicyDescription(this as ServicePlacementRequiredDomainPolicyDescription);
            }
            else if (this is ServicePlacementPreferPrimaryDomainPolicyDescription)
            {
                copy = new ServicePlacementPreferPrimaryDomainPolicyDescription(this as ServicePlacementPreferPrimaryDomainPolicyDescription);
            }
            else if (this is ServicePlacementRequireDomainDistributionPolicyDescription)
            {
                copy = new ServicePlacementRequireDomainDistributionPolicyDescription(this as ServicePlacementRequireDomainDistributionPolicyDescription);
            }
            else
            {
                copy = new ServicePlacementNonPartiallyPlaceServicePolicyDescription(this as ServicePlacementNonPartiallyPlaceServicePolicyDescription);
            }

            return(copy);
        }
コード例 #3
0
        internal static new unsafe ServicePlacementInvalidDomainPolicyDescription CreateFromNative(IntPtr nativePtr)
        {
            ReleaseAssert.AssertIfNot(nativePtr != IntPtr.Zero, StringResources.Error_NullNativePointer);
            NativeTypes.FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN_DESCRIPTION *casted =
                (NativeTypes.FABRIC_PLACEMENT_POLICY_INVALID_DOMAIN_DESCRIPTION *)nativePtr;

            var policy = new ServicePlacementInvalidDomainPolicyDescription();

            policy.DomainName = NativeTypes.FromNativeString(casted->InvalidFaultDomain);

            return(policy);
        }
コード例 #4
0
 // Copy ctor
 internal ServicePlacementInvalidDomainPolicyDescription(ServicePlacementInvalidDomainPolicyDescription other)
     : base(other)
 {
     this.DomainName = other.DomainName;
 }