示例#1
0
        /// <summary>
        /// Add a relationship between two objects. This is handled as a many to many relationship and will persist in both directions.
        /// You can retrieve this from either side T or U using the GetRelatedKeysFor method
        /// </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="keyU">The key of the related object</param>
        /// <param name="transformer"></param>
        public static void AddRelationship <T, U>(this IKVStore store, Key keyT, Key keyU, ITypeStringTransformer transformer = null)
        {
            var tr = transformer ?? new ForeignKeyTypeStringTransformer();

            store.AppendToCollection(tr.TransformFor <T, U>(keyT), keyU.Value);
            store.AppendToCollection(tr.TransformFor <U, T>(keyU), keyT.Value);
        }
 public void AppendToCollection <T>(Key key, T value)
 {
     _logger.LogStoreCall("AppendToCollection", key, value);
     try
     {
         _store.AppendToCollection(key, value);
     }
     catch (Exception ex)
     {
         _logger.LogError(ex);
     }
 }
示例#3
0
 public void AppendToCollection <T>(Key key, T value)
 {
     _store.AppendToCollection(_GetTransformedKey <T>(key), value);
 }
 public void AppendToCollection <T>(Key key, T value)
 {
     _writeActions.Enqueue(() => _store.AppendToCollection(key, value));
 }
 public void Add(Key key, Key p1)
 {
     _store.AppendToCollection(key.Value, p1);
 }