public object this[Type type] { get { var key = ProfileStorage.Key(type); var profileStorage = _persister.FindBy(_profileId, key).FirstOrDefault(); return(profileStorage != null?profileStorage.GetValue() : null); } set { if (value == null) { return; } var key = ProfileStorage.Key(value.GetType()); var valueStorage = _persister.FindBy(_profileId, key).FirstOrDefault(); if (valueStorage != null) { valueStorage.SetValue(value); _persister.Update(valueStorage); } else { valueStorage = new ProfileStorage(new TypeNameWithoutVersion(value.GetType())) { ProfileId = _profileId.Value }; valueStorage.SetValue(value); _persister.Insert(valueStorage); } } }
public void Update(ProfileStorage itemToUpdate) { _persister.Update(itemToUpdate); }