Update.
By just adding this line
this.Configuration.ProxyCreationEnabled = false;
to the DbContext base class I got the forms to show up.
Hi everybody,
We're in the process of switching to POCO from EDMX. I converted several classes and I am now getting errors from the browser when I try to bring the results. We were able to find out the reason for the errors by making a break point in the service.js file for the page (we're using AngularJs). The error is
Error getting value from 'IInvent' on 'System.Data.Entity.DynamicProxies.IItems_273E69562B3EC494497799CAC1345228EDCEF567C486A08DCDF17F86EA3173DC'."
exceptionType: "Newtonsoft.Json.JsonSerializationException"
innerException: Object
message: "An error has occurred."
stackTrace: " at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)
↵ at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract etc.
The object I am trying to bring in is simple but it has reverse navigation properties and it looks like there is a whole long chain of objects, because i_invent table is very deep in hierarchy. It is not related to the particular table (object) I am trying to work with.
So, I read this page about disabling the Proxy and I think it may be worth a shot.
http://msdn.microsoft.com/en-us/data/jj592886.aspxThe problem is that our classes are auto-generated. In that tool I see the following in the tt file:
DbContextName = "Our Name here";
ConnectionStringName = "Name here"; // Searches for this connection string in config files listed below
ConfigurationClassName = "Configuration"; // Configuration, Mapping, Map, etc. This is appended to the Poco class name to configure the mappings.
ConfigFilenameSearchOrder = new[] { "app.config", "web.config",
etc.
So, I suspect that I should be able to set the setting I need in that Configuration file. There is no Configuration file in the project at the moment. I am wondering if you know how this file is supposed to look like and if you used that tool and the configuration file.
The author of this tool is
If it's not broken, fix it until it is.
My Blog