我使用 Visual Studio Entity Framework PowerTools 对现有数据库的 Code First 模型对象进行逆向工程。我最终得到了这样的结果:
namespace PoolVAEFModel.Models
{
public class Pool
{
public Pool()
{
this.PoolWaterMetrics = new List<PoolWaterMetric>();
this.PoolWaterQualities = new List<PoolWaterQuality>();
}
public int Id { get; set; }
public string Symbol { get; set; }
public int WaterCapacityMax { get; set; }
public int WaterCapacityMin { get; set; }
public int WaterCapacityRegular { get; set; }
public string WallMaterial { get; set; }
public bool IsAboveGroundPool { get; set; }
public string ContactPhone { get; set; }
public string ContactEmail { get; set; }
public string SanitationMethod { get; set; }
public string LocationAddress { get; set; }
public bool HasHotTop { get; set; }
public bool JustHotTop { get; set; }
public int WaterCapacityUnitId { get; set; }
public double WaterDepthMax { get; set; }
public double WaterDepthMin { get; set; }
public int WaterDepthUnitId { get; set; }
public virtual Unit Unit { get; set; }
public virtual Unit Unit1 { get; set; }
public virtual ICollection<PoolWaterMetric> PoolWaterMetrics { get; set; }
public virtual ICollection<PoolWaterQuality> PoolWaterQualities { get; set; }
}
}
我想使用存储库模式来抽象数据库层,并且想知道如何处理引用的实体,例如
public virtual ICollection<PoolWaterMetric> PoolWaterMetrics { get; set; }
public virtual ICollection<PoolWaterQuality> PoolWaterQualities { get; set; }
我只是从我的类文件中删除并保留简单的属性吗?