Example #1
0
 private IDatabaseReader GetReader(IDatabaseComponent database, LibraryHierarchyNode libraryHierarchyNode, MetaDataItemType?metaDataItemType, string metaDataItemName, ITransactionSource transaction)
 {
     return(database.ExecuteReader(database.Queries.GetLibraryHierarchyMetaData(this.LibraryHierarchyBrowser.Filter), (parameters, phase) =>
     {
         switch (phase)
         {
         case DatabaseParameterPhase.Fetch:
             parameters["libraryHierarchyItemId"] = libraryHierarchyNode.Id;
             if (metaDataItemType.HasValue)
             {
                 parameters["type"] = metaDataItemType.Value;
             }
             else
             {
                 parameters["type"] = null;
             }
             if (!string.IsNullOrEmpty(metaDataItemName))
             {
                 parameters["name"] = metaDataItemName;
             }
             else
             {
                 parameters["name"] = null;
             }
             break;
         }
     }, transaction));
 }
Example #2
0
 private IDatabaseReader GetReader(IDatabaseComponent database, IEnumerable <PlaylistItem> playlistItems, MetaDataItemType?metaDataItemType, string metaDataItemName, ITransactionSource transaction)
 {
     return(database.ExecuteReader(database.Queries.GetPlaylistMetaData(playlistItems.Count()), (parameters, phase) =>
     {
         switch (phase)
         {
         case DatabaseParameterPhase.Fetch:
             var position = 0;
             foreach (var playlistItem in playlistItems)
             {
                 parameters["playlistItemId" + position] = playlistItem.Id;
                 position++;
             }
             if (metaDataItemType.HasValue)
             {
                 parameters["type"] = metaDataItemType.Value;
             }
             else
             {
                 parameters["type"] = null;
             }
             if (!string.IsNullOrEmpty(metaDataItemName))
             {
                 parameters["name"] = metaDataItemName;
             }
             else
             {
                 parameters["name"] = null;
             }
             break;
         }
     }, transaction));
 }