Dynamic OData with entity Framework #1317
Replies: 3 comments 3 replies
-
I'm adding some additiona info to clarify the problem.
Now I need to query this context using odata and I'm trying to modify this sample project: https://github.com/OData/AspNetCoreOData/tree/main/sample/ODataDynamicModel The sample just generate data programmatically like this: ` EdmEntityObject entity = new EdmEntityObject(entityType); collection.Add(entity);` In MyDataSource class. I need to modify it to get data directly from my datacontext passing all the odata filters. Is this possible ? Thanks |
Beta Was this translation helpful? Give feedback.
-
How Should I implement the ODataController ? |
Beta Was this translation helpful? Give feedback.
-
It works like a charm (filters included). In the controller: `[HttpGet("odata/{entityset}")]
}` In ApplicationEdmModel: `public static IEdmModel GetEdmModel()
The only problem left is related to this code in the startup.cs ConfigureService:
This is executed only once at application startup. So the model is not updated after I add another class/entity to the context at runtime. Thanks a lot man !!! |
Beta Was this translation helpful? Give feedback.
-
Hello,
i'm trying to adapt https://github.com/OData/AspNetCoreOData/tree/main/sample/ODataDynamicModel to use entity framework, but i'm not sure how to implement the ef querying part in the sample. I think i should change the Get() Methods in MyDataSource class, but i'm not sure how. Could you please give me some hints how to do this ?
Thanks
Best regards
Beta Was this translation helpful? Give feedback.
All reactions