मैं दो मॉडल 1)क्यों ईएफ नेविगेशन संपत्ति वापस शून्य?
public class Indicator
{
public long ID { get; set; }
public string Name { get; set; }
public int MaxPoint { get; set; }
public string Comment { get; set; }
public DateTime DateChanged { get; set; }
public DateTime DateCreated { get; set; }
public virtual IList<CalculationType> CalculationTypes { get; set; }
public virtual IList<TestEntity> TestEntitys { get; set; }
public virtual IndicatorGroup IndicatorGroup { get; set; }
}
2)
public class CalculationType
{
public long ID { get; set; }
public string UnitName { get; set; }
public int Point { get; set; }
public DateTime DateCreated { get; set; }
public DateTime DateChanged { get; set; }
public virtual Indicator Indicator { get; set; }
public virtual IList<Сalculation> Calculations { get; set; }
}
मैं इस कोड नेविगेशन संपत्ति CalculationTypes पर
var indicator = DataContext.Indicators.FirstOrDefault(i => i.ID == indicatorID);
var test = DataContext.CalculationTypes.FirstOrDefault();
पहली पंक्ति वापसी अशक्त को क्रियान्वित करने
दूसरी लाइन खाली संग्रह वापसी। क्यों?
अद्यतन स्नैपशॉट डेटाबेस परियोजना लिंक https://github.com/wkololo4ever/Stankin
गणना
public class Сalculation
{
public long ID { get; set; }
public virtual CalculationType CalculationType { get; set; }
public virtual ApplicationUser Creator { get; set; }
}
क्या आपने आलसी लोडिंग को अक्षम कर दिया है? –
@FarhadJabiyev LazyLoading सक्षम – kriper
मैं अपनी मैपिंग पोस्टिंग लगता – jbl