コード例 #1
0
ファイル: EntitySet.cs プロジェクト: Startitecture/storm
        /// <summary>
        /// Links two selections together based on the <paramref name="linkType"/>.
        /// </summary>
        /// <param name="linkType">
        /// The link type.
        /// </param>
        /// <param name="sourceSelection">
        /// The source selection.
        /// </param>
        /// <param name="targetSelection">
        /// The target selection.
        /// </param>
        /// <typeparam name="TDestEntity">
        /// The type of selection to link.
        /// </typeparam>
        /// <exception cref="ArgumentOutOfRangeException">
        /// <paramref name="linkType"/> is not one of the values of <see cref="SelectionLinkType"/>.
        /// </exception>
        private static void LinkSelection <TDestEntity>(
            SelectionLinkType linkType,
            EntitySet <TDestEntity> sourceSelection,
            EntitySet <TDestEntity> targetSelection)
            where TDestEntity : class, new()
        {
            switch (linkType)
            {
            case SelectionLinkType.Union:
                sourceSelection.Union(targetSelection);
                break;

            case SelectionLinkType.Intersection:
                sourceSelection.Intersect(targetSelection);
                break;

            case SelectionLinkType.Exception:
                sourceSelection.Except(targetSelection);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(linkType));
            }
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="LinkedSelection"/> class.
 /// </summary>
 /// <param name="selection">
 /// The parent selection.
 /// </param>
 /// <param name="linkType">
 /// The link type.
 /// </param>
 /// <exception cref="ArgumentNullException">
 /// <paramref name="selection"/> is null.
 /// </exception>
 public LinkedSelection([NotNull] IEntitySet selection, SelectionLinkType linkType)
 {
     this.Selection = selection ?? throw new ArgumentNullException(nameof(selection));
     this.LinkType  = linkType;
 }