Reputation: 1373
I've read a lot abuot storing images with attatchments. But I wonder what's the right way is to store image-INFO in ravenDb. So I then can use the info and get the image from some online-storage. I think i need the path.. maybe, with, height and so on... So what is the right way of doing this in the raven dbDocument.
Upvotes: 0
Views: 48
Reputation: 6841
Without knowing more about your requirements my basic answer is something like:
public class Image
{
/// <summary>
/// Gets or sets the original name of the Image.
/// </summary>
public string FileName { get; set; }
/// <summary>
/// Gets or sets the physical location of the Image
/// </summary>
public string Location {get; set;}
/// <summary>
/// Gets or sets the size of the file.
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// Gets or sets the MIME type of the file.
/// </summary>
public string MimeType { get; set; }
/// <summary>
/// Gets or sets the Width, in pixels, of the Image
/// </summary>
public int Width { get; set; }
/// <summary>
/// Gets or sets the Height, in pixels, of the Image
/// </summary>
public int Height { get; set; }
/// <summary>
/// Gets or sets the thumbnails.
/// </summary>
/// <value>
/// The thumbnails.
/// </value>
public ICollection<Thumbnail> Thumbnails { get; protected set; }
/// <summary>
/// Gets or sets the last Thumbnail id.
/// </summary>
public int LastThumbnailId { get; set; }
/// <summary>
/// Generates the new Thumbnail id.
/// </summary>
/// <returns></returns>
public int GenerateNewThumbnailId()
{
return ++LastThumbnailId;
}
}
public class Thumbnail
{
/// <summary>
/// Gets or sets the Thumbnail id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the Width, in pixels, of the Thumbnail
/// </summary>
public int Width { get; set; }
/// <summary>
/// Gets or sets the Height, in pixels, of the Thumbnail
/// </summary>
public int Height { get; set; }
/// <summary>
/// Gets or sets the physical location of the Thumbnail
/// </summary>
public string Location {get; set;}
}
Upvotes: 1