我有一个像这样的课程:
public class Soru
{
public void SoruKaydet(){...}
private static void SoruEtiketKaydet(Guid soruId, Etiket etiket, DbManager db){...}
public Guid? SoruId { get; set; }
public Guid? SoranId { get; set; }
public int? BakilmaSayisi { get; set; }
public string HtmlGovde { get; set; }
public string MarkdownGovde { get; set; }
public string Baslik { get; set; }
public int? KategoriId { get; set; }
public DateTime OlusturulmaTarihi { get; set; }
public List<Etiket> Etiketler { get; set; }
}
我需要另一个类应该包含类“Soru”中的一些变量。我有两种情况。
第一个场景:
public class SoruSayfa
{
public static List<SoruSayfa> SoruSayfaGetir(){...}
public Guid? SoruId { get; set; }
public Guid? SoranId { get; set; }
public int? BakilmaSayisi { get; set; }
public string Baslik { get; set; }
public int? KategoriId { get; set; }
public int DurumId { get; set; }
public double SoruPuani { get; set; }
public int CevapSayisi { get; set; }
public int BakilmaSayisi { get; set; }
public string KullaniciAdi { get; set; }
public double? KisiAlanPuani { get; set; }
}
第二种情况:
public class SoruSayfa
{
public static List<SoruSayfa> SoruSayfaGetir(){...}
// Refers the class Soru instead of some variables of it
public Soru MySoru { get; set; }
public int DurumId { get; set; }
public double SoruPuani { get; set; }
public int CevapSayisi { get; set; }
public int BakilmaSayisi { get; set; }
public string KullaniciAdi { get; set; }
public double? KisiAlanPuani { get; set; }
}
在第一种情况下,没有未使用的额外变量,但在第二种情况下,未使用 MySoru 的一些变量(HtmlGovde、MarkdownGovde、OlusturulmaTarihi、Etiketler)。此外,Soru 和 SoruSayfa 类将用作 asp .net MVC 中不同操作的模型。它们包含不同的方法。哪个场景更好?