在不使用附件的情况下在RavenDb中存储Image-info的正确方法

时间:2014-04-15 09:48:32

标签: ravendb

我已经阅读了许多附带存储图像的附件。但我想知道在ravenDb中存储image-INFO的正确方法是什么。所以我可以使用这些信息从一些在线存储中获取图像。 我想我需要路径..也许,有,高度等等......那么在乌鸦dbDocument中这样做的正确方法是什么。

1 个答案:

答案 0 :(得分:1)

在不了解您的要求的情况下,我的基本答案如下:

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;}
}