Пример #1
0
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects.
        /// </summary>
        internal static IList <InboundNatPool> ConvertFromProtocolCollection(IEnumerable <Models.InboundNATPool> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <InboundNatPool> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new InboundNatPool(o));

            return(converted);
        }
Пример #2
0
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects.
        /// </summary>
        internal static IList <VMExtension> ConvertFromProtocolCollection(IEnumerable <Models.VMExtension> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <VMExtension> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new VMExtension(o));

            return(converted);
        }
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects.
        /// </summary>
        internal static IList <UserAssignedIdentity> ConvertFromProtocolCollection(IEnumerable <Models.UserAssignedIdentity> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <UserAssignedIdentity> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new UserAssignedIdentity(o));

            return(converted);
        }
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects.
        /// </summary>
        internal static IList <NetworkSecurityGroupRule> ConvertFromProtocolCollection(IEnumerable <Models.NetworkSecurityGroupRule> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <NetworkSecurityGroupRule> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new NetworkSecurityGroupRule(o));

            return(converted);
        }
Пример #5
0
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects.
        /// </summary>
        internal static IList <ApplicationPackageReference> ConvertFromProtocolCollection(IEnumerable <Models.ApplicationPackageReference> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <ApplicationPackageReference> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new ApplicationPackageReference(o));

            return(converted);
        }
Пример #6
0
        /// <summary>
        /// Converts a collection of protocol layer objects to object layer collection objects, in a frozen state.
        /// </summary>
        internal static IList <CertificateReference> ConvertFromProtocolCollectionAndFreeze(IEnumerable <Models.CertificateReference> protoCollection)
        {
            ConcurrentChangeTrackedModifiableList <CertificateReference> converted = UtilitiesInternal.CollectionToThreadSafeCollectionIModifiable(
                items: protoCollection,
                objectCreationFunc: o => new CertificateReference(o).Freeze());

            converted = UtilitiesInternal.CreateObjectWithNullCheck(converted, o => o.Freeze());

            return(converted);
        }
        public static ConcurrentChangeTrackedModifiableList <T> TransformEnumerableToConcurrentModifiableList(IEnumerable <T> enumerable)
        {
            if (enumerable == null)
            {
                return(null);
            }

            ConcurrentChangeTrackedModifiableList <T> list = new ConcurrentChangeTrackedModifiableList <T>(enumerable);

            return(list);
        }
Пример #8
0
        /// <summary>
        /// Applies the <paramref name="objectCreationFunc"/> to each item in <paramref name="items"/> and returns a threadsafe collection containing the results.
        /// </summary>
        /// <typeparam name="TIn">The type of the input collection.</typeparam>
        /// <typeparam name="TOut">The type of the output collection.</typeparam>
        /// <param name="items">The collection to convert.</param>
        /// <param name="objectCreationFunc">The function used to created each <typeparamref name="TOut"/> type object.</param>
        /// <returns>A threadsafe collection containing the results of the conversion, or null if <paramref name="items"/> was null.</returns>
        internal static ConcurrentChangeTrackedModifiableList <TOut> CollectionToThreadSafeCollectionIModifiable <TIn, TOut>(
            IEnumerable <TIn> items,
            Func <TIn, TOut> objectCreationFunc)
            where TIn : class
            where TOut : class, IPropertyMetadata
        {
            ConcurrentChangeTrackedModifiableList <TOut> result = UtilitiesInternal.ConvertCollection(
                items,
                objectCreationFunc,
                (convertedItemsEnumerable) => new ConcurrentChangeTrackedModifiableList <TOut>(convertedItemsEnumerable));

            return(result);
        }