0
votes

I've implemented Abp.OData according to documentation. For example

http://localhost:21021/odata/regions?$count=true works without issue. It returns;

{"result":[{"id":1,"name":"Gebze"},{"id":2,"name":"Ankara"},{"id":3,"name":"Bursa"}],"targetUrl":null,"success":true,"error":null,"unAuthorizedRequest":false,"__abp":true}

But http://localhost:21021/odata/regions?$count=true&$skip=0&$top=12 doesn't work.

It returns;

{"result":null,"targetUrl":null,"success":false,"error":{"code":0,"message":"Sayfa işlenirken sunucu tarafında beklenmedik bir hata oluştu!","details":null,"validationErrors":null},"unAuthorizedRequest":false,"__abp":true}

My Startup file is:


And my oData controller is:

 using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.AspNetCore.OData.Controllers;
using Abp.Dependency;
using Abp.Domain.Repositories;
using Microsoft.AspNet.OData;
using TSE.Merkez.KalIsteks;

namespace TSE.Merkez.Web.Host.Controllers
{
    [EnableQuery]
    public class RegionsController : AbpODataEntityController<Region.Region>, ITransientDependency
    {
        public RegionsController(IRepository<Region.Region> repository) : base(repository)
        {
        }
        //[EnableQuery]
        //public override IQueryable<Region.Region> Get()
        //{

        //    return base.Get();
        //}
    }
}

I am gettin an error message given as below

ERROR 2019-02-25 12:10:21,218 [10 ] Mvc.ExceptionHandling.AbpExceptionFilter - Did not call Complete method of a unit of work. Abp.AbpException: Did not call Complete method of a unit of work. at Abp.Domain.Uow.InnerUnitOfWorkCompleteHandle.Dispose() at Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.d__4.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__10.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__13.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter.GetResult()

Do you have any idea? Where do I go wrong? Thanks in advance..

1
Could not repro. Create a repro project on GitHub that is forked from aspnetboilerplate/sample-odata.aaron

1 Answers

0
votes

Ok. Problem was solved. It was because of not constructing the entity proper way. I forced the abp to construct the entity with an extra Id property that comes form my old table. However Id column in an entity reserved for ABP framework. I should have not forced the framework to use my old Id property. I've transfered the old Id data to another column in entity and problem solved. Regards.