/// <summary> /// Sets the specified collection view. /// </summary> /// <param name="key">The key.</param> /// <param name="collection">The collection.</param> /// <param name="persistence">The persistence.</param> public string Set(string key, List<Media> collection, Persistence persistence) { byte[] bytes = System.Text.Encoding.Default.GetBytes(key); string encodedKey = HexEncoding.ToString(bytes); IEnumerable<int> ids = collection.Select(m => m.MediaId); string idCollection = string.Join(",", ids); PersistentCollection collection1 = _persistentCollectionRepository.Get(key); if (collection1 == null || collection1.Value != idCollection) { PersistentCollection persistentCollection = new PersistentCollection { CollectionKey = key, Persistence = persistence, Value = idCollection }; _persistentCollectionRepository.Set(persistentCollection); } return encodedKey; }
/// <summary> /// Sets the specified collection. /// </summary> /// <param name="collection">The collection.</param> public void Set(PersistentCollection collection) { database.NonQuery("PersistentCollection_Set", collection); }