Reputation: 3980
I am getting the weirdest of issues; I downgraded to ef5 6 is still playing up for me but now I am getting the follow it crashes on the line below
/// <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();
}
The error in question is
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll
I have a property that allows me to call my save context on other forms
private SMBASchedulerEntities _SourceEntities;
public SMBASchedulerEntities SourceEntities
{
get
{
_SourceEntities = new SMBASchedulerEntities();
return SourceEntities;
}
}
I don't know what is going on here as I have never come across this error before.
Upvotes: 0
Views: 925
Reputation: 1167
You are referencing your property in your property getter
private SMBASchedulerEntities _SourceEntities;
public SMBASchedulerEntities SourceEntities
{
get
{
_SourceEntities = new SMBASchedulerEntities();
return SourceEntities; <-- should be _SourceEntities
}
}
Basicly, this exception is thrown if there are too many calls within calls. (or as in this case "infinite")
Upvotes: 7