This is the Calling code
Code:
public List<Title> GetTitles()
{
try
{
return _dllayer.GetTitles().ToList();
}
catch (Exception ex)
{
throw new Exception(ex.InnerException.ToString());
}
the _dllayer object has:
Code:
public IList<Title> GetTitles()
{
try
{
using (My_Connection ctx = new MY_Connection())
{
return ctx.Titles.OfType<Title>().ToList();
}
}...
My_Connection is a partial Class generated by the entity Framework of the form:
Code:
public My_Connection() : base("name=MY_Connection", "My_Connection")
{
this.ContextOptions.LazyLoadingEnabled = true;
OnContextCreated();
}
And I can trace the error to this line:
public My_Connection() : base("name=MY_Connection", "My_Connection")
It doesn't get into setting LazyLoading.