طراحی جدول فایلهای پیوستی پایگاه داده
نویسنده: عثمان رحیمی
تاریخ: ۱۳۹۴/۱۰/۰۳ ۲۰:۵
آدرس: www.dntips.ir
| مطالب | ۳۶۹۴ |
| نویسندگان | ۲۷۶ |
| گروههای مطالب | ۱۰۲۴ |
| نقشههای راه | ۱۱۹ |
| دورهها | ۱۴ |
| اشتراکها | ۱۷۹۱۴ |
public class Article
{
public int Id { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public string RegisterDate { get; set; }
public string FileName { get; set; }
}
public class ArticleFiles
{
public int Id { get; set; }
public string FielName { get; set; }
public string FileExtension { get; set; }
public Article Article { get; set; }
public int FileSize { get; set; }
}
public class Attachment
{
public int Id { get; set; }
public string Title { get; set; }
public string FileName { get; set; }
public string Extension { get; set; }
public DateTime RegisterDate { get; set; }
public int Size { get; set; }
public ICollection<Article> ArticleFiles { get; set; }
public ICollection<News> NewsFiles { get; set; }
public int Viewed { get; set; }
} public class Attachment
{
public int Id { get; set; }
public string Title { get; set; }
public string FileName { get; set; }
public string Extension { get; set; }
public DateTime RegisterDate { get; set; }
public int Size { get; set; }
public string TableName { get; set; }
public int RowId { get; set; }
public int Viewed { get; set; }
}
2- داشتن یک جدول پایه که کل فایلها در آن ذخیره شوند (روشهای دوم و سوم)
از کدام روش استفاده کنیم؟
نمی توان پیشنهاد کرد که الزاما از کدامیک از روشهای بالا باید استفاده کنیم؛ چون نیازمندهایهای هر پروژه با هم متفات است و نمیتوان نسخهای خاص را برای همه تجویز کرد.
public class Attachment
{
#region Properties
/// <summary>
/// sets or gets identifier for attachment
/// </summary>
public virtual Guid Id { get; set; }
/// <summary>
/// sets or gets name for attachment
/// </summary>
public virtual string FileName { get; set; }
/// <summary>
/// sets or gets type of attachment
/// </summary>
public virtual string ContentType { get; set; }
/// <summary>
/// sets or gets size of attachment
/// </summary>
public virtual long Size { get; set; }
/// <summary>
/// sets or gets Extention of attachment
/// </summary>
public virtual string Extensions { get; set; }
/// <summary>
/// sets or gets Creation Date
/// </summary>
public virtual DateTime CreatedOn { get; set; }
/// <summary>
/// gets or sets counts of download this file
/// </summary>
public virtual long DownloadsCount { get; set; }
public virtual DateTime ModifiedOn { get; set; }
#endregion
#region NavigationProperties
/// <summary>
/// sets or gets identifier of attachment's owner
/// </summary>
public virtual long OwnerId { get; set; }
/// <summary>
/// sets or gets identifier of attachment's owner
/// </summary>
public virtual User Owner { get; set; }
#endregion
}