C# 类型为';的未处理异常;System.StackOverflowException';实体框架
我得到了最奇怪的问题;我降级到了ef5 6,但现在我得到了下面这条线上的跟随,它崩溃了C# 类型为';的未处理异常;System.StackOverflowException';实体框架,c#,entity-framework,C#,Entity Framework,我得到了最奇怪的问题;我降级到了ef5 6,但现在我得到了下面这条线上的跟随,它崩溃了 /// <summary> /// Initializes a new SMBASchedulerEntities object using the connection string found in the 'SMBASchedulerEntities' section of the application configuration file. /// </summary>
/// <summary>
/// Initializes a new SMBASchedulerEntities object using the connection string found in the 'SMBASchedulerEntities' section of the application configuration file.
/// </summary>
public SMBASchedulerEntities() : base("name=SMBASchedulerEntities", "SMBASchedulerEntities")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
我不知道这里发生了什么,因为我以前从未遇到过这个错误。您正在属性getter中引用您的属性
private SMBASchedulerEntities _SourceEntities;
public SMBASchedulerEntities SourceEntities
{
get
{
_SourceEntities = new SMBASchedulerEntities();
return SourceEntities; <-- should be _SourceEntities
}
}
私有SMBASScheduleEntities\u SourceEntities;
公共SMBASScheduleEntities源实体
{
得到
{
_SourceEntities=新的SMBASScheduleEntities();
返回源实体;
private SMBASchedulerEntities _SourceEntities;
public SMBASchedulerEntities SourceEntities
{
get
{
_SourceEntities = new SMBASchedulerEntities();
return SourceEntities; <-- should be _SourceEntities
}
}