I create controllers using entity. There are severel models in my project and for every model in context "Get method" works fine, but this one, which is the same like others, did'nt.
This is simple code:
// GET: api/Proizvodi
public IQueryable<Proizvodi> GetProizvodi()
{
return db.Proizvodi;
}
I tested with fidler and this is message:
{"Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"Message":"An error has occurred.","ExceptionMessage":"Self referencing loop detected with type 'System.Data.Entity.DynamicProxies.Proizvodi_B322A16527536C491FCFE47A9DC60617BBB3A2AAF1FABD41D99F924F0D8FE589'. Path '[0].JediniceMjere.Proizvodi'.","ExceptionType":"Newtonsoft.Json.JsonSerializationException",...
I know there are severel same question and im looking for answer but can't find. Is there problem with entity freimwork, problem with serialization or something else. ??
Maybe this help: when i delete all records from database for this model/class, "Proizvodi", i get "HTTP/1.1 200 OK".
IQueryable<>
. Use something else likeList<>
. – DavidGProizvodi
class? – DavidG