jojacafe
1/23/2017 - 1:51 PM

Entity Framework sin includes de tablas relacionadas https://msdn.microsoft.com/es-es/library/bb896272%28v=vs.100%29.aspx?f=255&MSPPError=-

- Para deshabilitar la carga diferida, establezca la propiedad LazyLoadingEnabled en false en la instancia de ObjectContextOptions devuelta por la propiedad System.Data.Objects.ObjectContext.ContextOptions

*Solución*:
- public AbcRestaurantsEntities(): base("name=AbcRestaurantsEntities")
  {
      this.Configuration.LazyLoadingEnabled = false;
  }
- Eliminar todos los decoradores 'virtual'
GlobalConfiguration.Configure(WebApiConfig.Register);

            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.PreserveReferencesHandling = PreserveReferencesHandling.None;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); //json en minusculas
            GlobalConfiguration.Configuration.Formatters.Remove(GlobalConfiguration.Configuration.Formatters.XmlFormatter); //error get desde navegador
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.Utc;
            GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat;
            //GlobalConfiguration.Configuration.Formatters.JsonFormatter.SerializerSettings.Formatting = Newtonsoft.Json.Formatting.Indented;