public void Delete(ProfileId profileId, TypeNameWithoutVersion key) { using (var context = CreateContext()) { const string cmd = "delete dbo.ProfileStorage where dbo.ProfileStorage.ProfileId = {0} AND dbo.ProfileStorage.ValueKey = {1}"; context.ExecuteCommand(cmd, profileId.Value, key.Value); } }
public void Delete(ProfileId profileId, TypeNameWithoutVersion key, params StorageName[] storageNames) { using (var context = CreateContext()) { var inClausePlaceholders = string.Join(",", storageNames.Select((x, i) => "{{{0}}}".Fmt(i + 2))); var parameters = new object[] { profileId.Value, key.Value }.Concat(storageNames.Select(x => x.Value)); var cmd = "delete dbo.ProfileStorage where dbo.ProfileStorage.ProfileId = {0} AND dbo.ProfileStorage.ValueKey = {1} AND dbo.ProfileStorage.Name IN (" + inClausePlaceholders + ")"; context.ExecuteCommand(cmd, parameters.ToArray()); } }
public IEnumerable<ProfileStorage> FindBy(ProfileId profileId, TypeNameWithoutVersion key) { using (var context = CreateContext()) { int id = profileId.Value; string valueKey = key.Value; return (from profileStorage in context.ProfileStorages where profileStorage.ProfileId == id && profileStorage.ValueKey == valueKey select profileStorage).ToArray(); } }
public bool Contains(StorageName storageName, ProfileId profileId, TypeNameWithoutVersion key, object item) { return FindBy(storageName, profileId, key, item) != null; }
public ProfileStorage FindBy(ProfileId profileId, TypeNameWithoutVersion key, object item) { var itemsToSearch = FindBy(profileId, key); return itemsToSearch.Where(profileStorage => profileStorage.GetValue().Equals(item)).FirstOrDefault(); }
public ProfileStorage FindBy(StorageName storageName, ProfileId profileId, TypeNameWithoutVersion key, object item) { return FindBy(profileId, key).Where(x => x.GetValue() == item && storageName.Value == x.Name).FirstOrDefault(); }
public IEnumerable<ProfileStorage> FindBy(ProfileId profileId, TypeNameWithoutVersion key, params StorageName[] storageNames) { using (var context = CreateContext()) { int id = profileId.Value; string valueKey = key.Value; var starageNameValues = storageNames.Select(s => s.Value); return (from profileStorage in context.ProfileStorages where profileStorage.ProfileId == id && profileStorage.ValueKey == valueKey && starageNameValues.Contains(profileStorage.Name) select profileStorage).ToArray(); } }
public IEnumerable<ProfileStorage> FindBy(ProfileId profileId, TypeNameWithoutVersion key, params StorageName[] storageNames) { return FindBy(profileId).Where(x => x.ValueKey == key.Value && storageNames.Select(s => GetLowerOrNull(s.Value)).Contains(GetLowerOrNull(x.Name))); }
public IEnumerable<ProfileStorage> FindBy(ProfileId profileId, TypeNameWithoutVersion key) { return FindBy(profileId).Where(x => x.ValueKey == key.Value); }
public void Delete(ProfileId profileId, TypeNameWithoutVersion key, params StorageName[] storageNames) { _profileStorage.RemoveAll(x => storageNames.Select(s => s.Value).Contains(x.Name) && x.ProfileId == profileId.Value && x.ValueKey == key.Value); }
public void Delete(ProfileId profileId, TypeNameWithoutVersion key) { _profileStorage.RemoveAll(x => x.ProfileId == profileId.Value && x.ValueKey == key.Value); }
public bool Equals(TypeNameWithoutVersion other) { if (ReferenceEquals(null, other)) return false; if (ReferenceEquals(this, other)) return true; return Equals(other.Value, Value); }