Пример #1
0
            /// <summary>
            /// Exits the current update operation.
            /// </summary>
            public void Dispose()
            {
                if (collection != null)
                {
                    Interlocked.Exchange(ref collection.operation, null);

                    collection = null;
                }
            }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NavigableCollectionService{T, TMetadata}"/> class.
 /// </summary>
 /// <param name="collection">The underlying collection.</param>
 internal NavigableCollectionService(NavigableCollection <T, TMetadata> collection)
 {
     this.collection = collection;
 }
Пример #3
0
        /// <summary>
        /// Creates a <see cref="INavigationService"/> wrapper over the <see cref="NavigableCollection{T, TMetadata}"/>.
        /// </summary>
        /// <typeparam name="T">The type of the navigable objects in the collection.</typeparam>
        /// <typeparam name="TMetadata">The type of the metadata of the navigable objects.</typeparam>
        /// <param name="collection">The <see cref="NavigableCollection{T, TMetadata}"/> to wrap.</param>
        /// <returns>The <see cref="INavigationService"/> wrapper over the <paramref name="collection"/>.</returns>
        public static INavigationService CreateService <T, TMetadata>(this NavigableCollection <T, TMetadata> collection) where T : class where TMetadata : INavigationMetadata
        {
            Requires.NotNull(collection, nameof(collection));

            return(new NavigableCollectionService <T, TMetadata>(collection));
        }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Navigation"/> class.
 /// </summary>
 /// <param name="collection">The underlying collection.</param>
 internal Navigation(NavigableCollection <T, TMetadata> collection) : base(collection)
 {
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Recomposition"/> class.
 /// </summary>
 /// <param name="collection">The underlying collection.</param>
 internal Recomposition(NavigableCollection <T, TMetadata> collection) : base(collection)
 {
 }
Пример #6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="SynchronizedOperation"/> class.
            /// </summary>
            /// <param name="collection">The underlying collection.</param>
            protected SynchronizedOperation(NavigableCollection <T, TMetadata> collection)
            {
                this.collection = collection;

                Interlocked.CompareExchange(ref collection.operation, this, null)?.Throw();
            }