{"action":"opened","issue":{"url":"https://api.github.com/repos/trenoncourt/AutoQueryable/issues/73","repository_url":"https://api.github.com/repos/trenoncourt/AutoQueryable","labels_url":"https://api.github.com/repos/trenoncourt/AutoQueryable/issues/73/labels{/name}","comments_url":"https://api.github.com/repos/trenoncourt/AutoQueryable/issues/73/comments","events_url":"https://api.github.com/repos/trenoncourt/AutoQueryable/issues/73/events","html_url":"https://github.com/trenoncourt/AutoQueryable/issues/73","id":362734598,"node_id":"MDU6SXNzdWUzNjI3MzQ1OTg=","number":73,"title":"AutoQueryable with AutoMapper and ASP.Net core","user":{"login":"tomkurian01","id":10654472,"node_id":"MDQ6VXNlcjEwNjU0NDcy","avatar_url":"https://avatars2.githubusercontent.com/u/10654472?v=4","gravatar_id":"","url":"https://api.github.com/users/tomkurian01","html_url":"https://github.com/tomkurian01","followers_url":"https://api.github.com/users/tomkurian01/followers","following_url":"https://api.github.com/users/tomkurian01/following{/other_user}","gists_url":"https://api.github.com/users/tomkurian01/gists{/gist_id}","starred_url":"https://api.github.com/users/tomkurian01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomkurian01/subscriptions","organizations_url":"https://api.github.com/users/tomkurian01/orgs","repos_url":"https://api.github.com/users/tomkurian01/repos","events_url":"https://api.github.com/users/tomkurian01/events{/privacy}","received_events_url":"https://api.github.com/users/tomkurian01/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-21T18:49:37Z","updated_at":"2018-09-21T18:49:37Z","closed_at":null,"author_association":"NONE","body":"I'm using AutoQueryable along with AutoMapper. And everything is working great until I try to use automapper to send back a DTO back to the client.\r\n\r\nSo the below code works great:\r\n\r\n        [AutoQueryable]\r\n        public IQueryable<DatabaseClassName> Get([FromServices] IQueryableRepository repository)\r\n        {\r\n\r\n            return repository.GetIQueryable<DatabaseClassName>();\r\n        }\r\n\r\nHowever this code is not working:\r\n\r\n        [AutoQueryable]\r\n        public IQueryable<ViewModel> Get([FromServices] IQueryableRepository repository)\r\n        {\r\n\r\n            return repository.GetIQueryable<DatabaseClassName>().UseAsDataSource(_mapper).For<ViewModel>();\r\n        }\r\n\r\nIn my Mapper Profile Class I have set it up like this:\r\n\r\n    public class MapperProfile : Profile\r\n    {\r\n        public MapperProfile()\r\n        {\r\n\r\n            CreateMap<DatabaseClassName, ViewModel>().ReverseMap();\r\n            //CreateMap(typeof(Source<>), typeof(Destination<>)).ReverseMap();\r\n            \r\n        }\r\n    }\r\n\r\nin my Startup class (ConfigureServices method) I have placed in:\r\n\r\n            services.AddAutoMapper();\r\n\r\nThe error comes up as this:\r\n\r\n    System.RuntimeType.GetPropertyImpl(string name, BindingFlags bindingAttr, Binder binder, Type returnType, Type[] types, ParameterModifier[] modifiers)\r\n    System.Type.GetProperty(string name, BindingFlags bindingAttr)\r\n    System.Reflection.TypeExtensions.GetProperty(Type type, string name, BindingFlags bindingAttr)\r\n    AutoQueryable.Helpers.SelectHelper.GetMemberExpression<TEntity>(Expression parent, SelectColumn column, IAutoQueryableProfile profile, bool isLambdaBody)\r\n    AutoQueryable.Helpers.SelectHelper.InitType<TEntity>(IEnumerable<SelectColumn> columns, Expression node, IAutoQueryableProfile profile)\r\n    AutoQueryable.Helpers.SelectHelper.GetSelector<TEntity, TResult>(ICollection<SelectColumn> selectColumns, IAutoQueryableProfile profile)\r\n    AutoQueryable.Core.Models.AutoQueryHandler.GetDefaultSelectableQuery<T>(IQueryable<T> query)\r\n    AutoQueryable.Core.Models.AutoQueryHandler.GetAutoQuery<T>(IQueryable<T> query)\r\n    AutoQueryable.Core.Models.AutoQueryableContext.GetAutoQuery<T>(IQueryable<T> query)\r\n    System.Dynamic.UpdateDelegates.UpdateAndExecute2<T0, T1, TRet>(CallSite site, T0 arg0, T1 arg1)\r\n    AutoQueryable.AspNetCore.Filter.FilterAttributes.AutoQueryableFilter.OnActionExecuted(ActionExecutedContext context)\r\n    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)\r\n    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()\r\n    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)\r\n    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(ref State next, ref Scope scope, ref object state, ref bool isCompleted)\r\n    Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()\r\n    Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()\r\n    Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()\r\n    Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)\r\n    Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)\r\n\r\nI was curious if anyone had any suggestions on fixing this."}}
{"actor":{"display_login":"tomkurian01"}}