Example #1
0
        /// <summary>
        /// Clears all relationships in both directtions between two types of objects connected to the source key.
        /// </summary>
        /// <typeparam name="T">The type of the sorce object</typeparam>
        /// <typeparam name="U">The type of the related object</typeparam>
        /// <param name="store">The underlying store</param>
        /// <param name="keyT">The key of the source object</param>
        /// <param name="transformer"></param>
        public static void ClearRelationships <T, U>(this IKVStore store, Key keyT,
                                                     ITypeStringTransformer transformer = null)
        {
            var tr = transformer ?? new ForeignKeyTypeStringTransformer();

            var keys = store.GetRelatedKeysFor <T, U>(keyT, tr);

            foreach (var keyU in keys)
            {
                store.RemoveRelationship <T, U>(keyT, keyU, tr);
            }
        }