Entity framework 如果我计划在存储库模式中使用实体框架代码优先模型中引用的实体属性,我是否会删除它们

Entity framework 如果我计划在存储库模式中使用实体框架代码优先模型中引用的实体属性,我是否会删除它们,entity-framework,ef-code-first,repository-pattern,Entity Framework,Ef Code First,Repository Pattern,我使用VisualStudioEntityFramework PowerTools对现有数据库的代码优先模型对象进行反向工程。我的结局是这样的: namespace PoolVAEFModel.Models { public class Pool { public Pool() { this.PoolWaterMetrics = new List<PoolWaterMetric>(); t

我使用VisualStudioEntityFramework PowerTools对现有数据库的代码优先模型对象进行反向工程。我的结局是这样的:

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; }
    }
}
namespace PoolVAEFModel.Models
{
公共班级游泳池
{
公共泳池()
{
this.PoolWaterMetrics=新列表();
this.PoolWaterQualities=新列表();
}
公共int Id{get;set;}
公共字符串符号{get;set;}
public int WaterCapacityMax{get;set;}
公共int WaterCapacityMin{get;set;}
公共int水容量规则{get;set;}
公共字符串WallMaterial{get;set;}
公共bool isbovegroundpool{get;set;}
公共字符串联系人电话{get;set;}
公共字符串ContactEmail{get;set;}
公共字符串清理方法{get;set;}
公共字符串位置地址{get;set;}
公共bool HasHotTop{get;set;}
公共bool JustHotTop{get;set;}
public int WaterCapacityUnitId{get;set;}
公共双WaterDepthMax{get;set;}
公共双WaterDepthMin{get;set;}
public int WaterDepthUnitId{get;set;}
公共虚拟单元单元{get;set;}
公共虚拟单元Unit1{get;set;}
公共虚拟ICollection PoolWaterMetrics{get;set;}
公共虚拟ICollection池{get;set;}
}
}
我想使用Repository模式来抽象数据库层,并且想知道如何处理引用的实体,例如

    public virtual ICollection<PoolWaterMetric> PoolWaterMetrics { get; set; }
    public virtual ICollection<PoolWaterQuality> PoolWaterQualities { get; set; }
公共虚拟ICollection PoolWaterMetrics{get;set;} 公共虚拟ICollection池{get;set;}
我是否只是从类文件中删除并保留简单属性?

代码优先power tools创建了这些导航集合,因为数据库中的这些表之间存在映射外键关系。如果您不打算在代码中使用导航属性,请随意删除,这不会造成任何伤害