protected IEnumerable <(Guid Id, string Name, DateTime Date)> GetMiaTypes(bool useBackupTable = false) { ISQLDatabase database = ServiceRegistration.Get <ISQLDatabase>(false); using (ITransaction transaction = database.BeginTransaction()) { List <(Guid Id, string Name, DateTime Date)> miams = new List <(Guid Id, string Name, DateTime Date)>(); int idIndex; int nameIndex; int dateIndex; IDbCommand command; if (useBackupTable) { command = SelectAllBackupMediaItemAspectMetadataNameAndCreationDatesCommand(transaction, out idIndex, out nameIndex, out dateIndex); } else { command = MediaLibrary_SubSchema.SelectAllMediaItemAspectMetadataNameAndCreationDatesCommand(transaction, out idIndex, out nameIndex, out dateIndex); } using (command) using (IDataReader reader = command.ExecuteReader()) { ICollection <string> result = new List <string>(); while (reader.Read()) { miams.Add((reader.GetGuid(idIndex), reader.GetString(nameIndex), reader.GetDateTime(dateIndex))); } } return(miams); } }
/// <summary> /// Gets all media item ids from the database. /// </summary> /// <returns></returns> protected ICollection <Guid> GetAllMediaItemIds() { HashSet <Guid> mediaItemIds = new HashSet <Guid>(); ISQLDatabase database = ServiceRegistration.Get <ISQLDatabase>(); using (ITransaction transaction = database.BeginTransaction()) using (IDbCommand command = MediaLibrary_SubSchema.SelectAllMediaItemIdsCommand(transaction)) using (var reader = command.ExecuteReader()) while (reader.Read()) { mediaItemIds.Add(database.ReadDBValue <Guid>(reader, 0)); } return(mediaItemIds); }