/// <overloads>Determine the type of the media object (image, video, audio, generic, etc) specified by the parameter(s). 
 /// This method returns GalleryObjectType.Unknown if no matching MIME type can be found. Guaranteed to not 
 /// return null.</overloads>
 /// <summary>
 /// Determine the type of the media object (image, video, audio, generic, etc) based on its ID. 
 /// This method returns GalleryObjectType.Unknown if no matching MIME type can be found. Guaranteed to not 
 /// return null.
 /// </summary>
 /// <param name="mediaObjectId">An integer representing a media object that exists in the data store. If no 
 /// matching media object is found, an InvalidMediaObjectException is thrown. (this will occur when no 
 /// matching record exists in the data store, or the ID actually represents an album ID). If a media object 
 /// is found, but no MIME type is declared in the configuration file that matches the file's extension, 
 /// GalleryObjectType.Unknown is returned.</param>
 /// <returns>Returns a GalleryObjectType enum indicating the type of media object specified by the 
 /// mediaObjectId parameter. Guaranteed to not return null.</returns>
 /// <remarks>Use this method for existing objects that have previously been added to the data store. </remarks>
 /// <exception cref="GalleryServerPro.Events.CustomExceptions.InvalidMediaObjectException">Thrown 
 /// when the mediaObjectId parameter does not represent an existing media object in the data store.</exception>
 public static GalleryObjectType DetermineMediaObjectType(int mediaObjectId)
 {
     using (var repo = new MediaObjectRepository())
     {
         return DetermineMediaObjectType(repo.Find(mediaObjectId));
     }
 }
Exemple #2
0
		private static MediaObjectDto GetMediaObjectById(int mediaObjectId, bool includeMetadata)
		{
			using (var repo = new MediaObjectRepository())
			{
				return (includeMetadata ? repo.Where(m => m.MediaObjectId == mediaObjectId, m => m.Metadata).FirstOrDefault() : repo.Find(mediaObjectId));
			}
		}