Closed mehmetuken closed 1 year ago
Any news on this? I would like to use ABP.io as the back end of a Blazor App, powered by Syncfusion controls. These work best with remote data over OData. Link: https://ej2.syncfusion.com/blazor/documentation/grid/data-binding/?no-cache=1#web-api
Haven't worked on this yet. And contribution is appreciated :)
Has to wait for https://github.com/OData/WebApi/issues/1748
in .Net Core 2.2, I used app.UseMvc and set routes.EnableDependencyInjection(); routes.Select().Filter().Expand().MaxTop(null).OrderBy().Count(); through IRoutingBuilder extension methods. Now, in .Net Core 3.0, when I use app.UseEndpoints, how can I do this for injecting ODataQueryOptions? In other words, how to enable OData components on non-OData routes in .net core 3.0 Endpoints?
@MasiumDev We should first wait for ODate to support net core 3.0. https://github.com/abpframework/abp/issues/990#issuecomment-549988064
@MasiumDev We should first wait for ODate to support net core 3.0. #990 (comment)
Since version 7.3 has support for net core 3.1
OData team are researching an revolutionary change to OData. Something we call OData NxT. The goal is reconceptualize OData by making it more modular, technology-agnostic and transcendable! https://github.com/OData/AspNetCoreOData/issues/206
@hikalkan @ismcagdas Actually, using the OData with ABP is almost not possible. The default FullAggregation model can't be used in OData, it generates wrong LINQ query:
System.InvalidOperationException: The LINQ expression 'DbSet<IdentityUser>()
.Where(i => __ef_filter__p_0 || !(EF.Property<bool>(i, "IsDeleted")) && __ef_filter__p_1 || (Guid?)EF.Property<Guid>(i, "TenantId") == __ef_filter__CurrentTenantId_2)
.Where(i => (string)i.ExtraProperties.ContainsKey("UserName") ? i.ExtraProperties["UserName"] : null == __TypedProperty_0)' could not be translated. Additional information: Translation of method 'System.Collections.Generic.Dictionary<string, object>.ContainsKey' failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
Same story with the extensions for existing models, for example if you want add new field to IdentityUser (MIddleName in my case) and then use it in the $filter you will get the error. The worst that this error will not be handled, and you will get the half-response like this (this is actual response from the body):
{"@odata.context":"https://localhost:44317/odata/$metadata#Users","value":[
But you may see error in the logs:
[03:53:10 ERR] Connection ID "17870283327311709214", Request ID "8000041f-0001-f800-b63f-84710c7967bb": An unhandled exception was thrown by the application.
System.InvalidOperationException: The LINQ expression 'DbSet<IdentityUser>()
.Where(i => __ef_filter__p_0 || !(EF.Property<bool>(i, "IsDeleted")) && __ef_filter__p_1 || (Guid?)EF.Property<Guid>(i, "TenantId") == __ef_filter__CurrentTenantId_2)
.Where(i => i.Surname == __TypedProperty_0 && i.Name == __TypedProperty_1 && (string)i.ExtraProperties.ContainsKey("MiddleName") ? i.ExtraProperties["MiddleName"] : null == __TypedProperty_2)' could not be translated. Additional information: Translation of method 'System.Collections.Generic.Dictionary<string, object>.ContainsKey' failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.<VisitMethodCall>g__CheckTranslated|15_0(ShapedQueryExpression translated, <>c__DisplayClass15_0& )
at Microsoft.EntityFrameworkCore.Query.QueryableMethodTranslatingExpressionVisitor.VisitMethodCall(MethodCallExpression methodCallExpression)
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
Does abp.io support odata ?
I think it actually can work with OData. I write an example about running ABP vnext with OData.
However, auto api and appservice endpoint are not supported in the approach (This is why I use with
rather than supporting
). You still need to implement your controllers.
We are not interested in creating a specific OData integration at the moment. You can create your OData endpoint with its own API.
OData can be used now, no restriction. However, we can create an integration package to provide some base class and services to develop OData controllers easier (like did before for current aspnetboilerplate). I added this to backlog.