Example #1
0
        /// <summary>
        /// Get the current version with only the keys applicable to a type
        /// </summary>
        /// <param name="type">The type to which the keys must be applicable</param>
        /// <returns>Current Item version with only the keys applicable to a type</returns>
        public ItemVersion CurrentVersionForType(Type type)
        {
            var vsn = new ItemVersion(CurrentVersion);

            foreach (var versioner in Versioners)
            {
                if (!versioner.Versionable(type))
                {
                    vsn.Remove(versioner.VersionKey);
                }
            }

            return(vsn);
        }
Example #2
0
        /// <summary>
        /// Find all specific ItemVersions which are applicable to a type
        /// </summary>
        /// <param name="t">The type</param>
        /// <returns>All applicable ItemVersion</returns>
        public List <ItemVersion> MatchingVersions(Type t)
        {
            var vsn   = new ItemVersion(this);
            var other = VersionManager.Instance.VersionForType(t);

            foreach (var key in this.Keys)
            {
                if (!other.ContainsKey(key))
                {
                    vsn.Remove(key);
                }
            }
            foreach (var key in other.Keys)
            {
                if (!vsn.ContainsKey(key))
                {
                    vsn.Add(key, null);
                }
            }
            return(vsn.Expand());
        }