我创建了以下类,它描述了用户可能上传的任何类型的文件:
namespace MyModels.Models
{
public class File
{
public string FileName { get; set; }
public string FileTypeId { get; set; }
public string URLFileName { get; set; } //cleaned for web
public string Dir { get; set; } //which directory is located in
public long FileSize { get; set; } //size in bytes
public DateTime DateAdded { get; set; } //date uploaded
public int UploadedByUser {get; set;} //UserID of user
public bool inCloud { get; set; } // moved to cloud
public bool inGlacier { get; set; } // moved to glaciers
public DateTime? DateTrashed { get; set; } //date user deleted
public int TrashedByUser { get; set; } //UserID of user
public List<FileDescendent> Descendents { get; set; } //List of copies
}
}
然后我想为图像文件创建一个类。我希望这个类也有文件属性。我这样做吗?
namespace MyModels.Models
{
public class Image : File
{
public int OrigHeight { get; set; }
public int OrigWidth { get; set; }
}
}
或这个?
namespace MyModels.Models
{
public class Image
{
public int OrigHeight { get; set; }
public int OrigWidth { get; set; }
public File File { get; set; }
}
}
请问有什么区别?
谢谢!