Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "ice2burn"

The more examples we have, the better and faster we understand framework in general

What a pity, it would be so elegant.

Made it with separate query:

foreach (var ticket in tickets)
{
    var linkedUsers = _ticketLinkedUsersRepository.GetAllIncluding(lu => lu.TicketLinkType, lu => lu.User)
        .Where(p => p.TicketId == ticket.Ticket.Id).ToList();
    ticket.LinkedUsers = ObjectMapper.Map<List<TicketLinkedUserDto>>(linkedUsers);
 }

Thanks for your help

You are right, it should be J7.

However I get different error in log:

INFO  2018-08-24 13:30:05,375 [21   ] ore.Mvc.Internal.ControllerActionInvoker - Executing action method Fansy.IdentityServer.Tickets.TicketsAppService.GetAll (Fansy.IdentityServer.Application) with arguments (Fansy.IdentityServer.Tickets.Dtos.GetAllTicketsInput) - Validation state: Valid
ERROR 2018-08-24 13:30:24,275 [3    ] Mvc.ExceptionHandling.AbpExceptionFilter - Incorrect number of arguments supplied for call to method 'System.Threading.Tasks.Task`1[System.Boolean] MoveNext(System.Threading.CancellationToken)'
Parameter name: method
System.ArgumentException: Incorrect number of arguments supplied for call to method 'System.Threading.Tasks.Task`1[System.Boolean] MoveNext(System.Threading.CancellationToken)'
Parameter name: method
   at System.Dynamic.Utils.ExpressionUtils.ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, Int32 count, ParameterInfo[] pis)
   at System.Linq.Expressions.Expression.Call(Expression instance, MethodInfo method)
   at AutoMapper.Internal.ExpressionFactory.ForEach(Expression collection, ParameterExpression loopVar, Expression loopContent)
   at AutoMapper.Mappers.Internal.CollectionMapperExpressionFactory.MapCollectionExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, PropertyMap propertyMap, Expression sourceExpression, Expression destExpression, Expression contextExpression, Type ifInterfaceType, MapItem mapItem)
   at AutoMapper.Mappers.CollectionMapper.MapExpression(IConfigurationProvider configurationProvider, ProfileMap profileMap, PropertyMap propertyMap, Expression sourceExpression, Expression destExpression, Expression contextExpression)
   at AutoMapper.MapperConfiguration.GenerateObjectMapperExpression(MapRequest mapRequest, IObjectMapper mapperToUse, MapperConfiguration mapperConfiguration)
   at AutoMapper.MapperConfiguration.BuildExecutionPlan(MapRequest mapRequest)
   at AutoMapper.MapperConfiguration.CreateMapperFuncs(MapRequest mapRequest)
   at AutoMapper.LockingConcurrentDictionary`2.&lt;&gt;c__DisplayClass2_1.&lt;.ctor&gt;b__1()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at AutoMapper.MapperConfiguration.GetUntypedMapperFunc(MapRequest mapRequest)
   at AutoMapper.Mapper.AutoMapper.IMapper.Map[TDestination](Object source)
   at lambda_method(Closure , TransparentIdentifier`2 )
   at System.Linq.AsyncEnumerable.SelectEnumerableAsyncIterator`2.MoveNextCore(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.AsyncIterator`1.MoveNext(CancellationToken cancellationToken)
   at System.Linq.AsyncEnumerable.Aggregate_[TSource,TAccumulate,TResult](IAsyncEnumerable`1 source, TAccumulate seed, Func`3 accumulator, Func`2 resultSelector, CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.TaskResultAsyncEnumerable`1.Enumerator.MoveNext(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.AsyncLinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext(CancellationToken cancellationToken)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.ExecuteSingletonAsyncQuery[TResult](QueryContext queryContext, Func`2 compiledQuery, IDiagnosticsLogger`1 logger, Type contextType)
   at Fansy.IdentityServer.Tickets.TicketsAppService.GetAll(GetAllTicketsInput input) in D:\Work\Web\FansySystems\IdentityServer\src\Fansy.IdentityServer.Application\Tickets\TicketsAppService.cs:line 142
   at lambda_method(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()
   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.InvokeInnerFilterAsync()
   at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextExceptionFilterAsync()
INFO  2018-08-24 13:30:24,284 [3    ] .Mvc.Infrastructure.ObjectResultExecutor - Executing ObjectResult, writing value of type 'Abp.Web.Models.AjaxResponse'.
Answer

Thank you, I subscribed on notifications

Answer

Hi,

Thank you for screencast, sorry, I didnt make my problem clear.

Here are my steps:

  1. Create latest aspnetzero template. Start both sites. Make sure they are opened in the same browser. (vs 2017 may start each site in separate browser process, so just copy the path of one of them and create new tab. It's important for step 4)
  2. Clear cookies on both sites, just in case and refresh the pages.
  3. Login to Web.Mvc on localhost:62114. Now we see dashboard.
  4. Switch to Web.Public on localhost:45776 and login. We login automatically, since we have already made it in previous step. You should not see login screen.
  5. Switch back to localhost:62114 and refresh page. We are not authorized anymore on Web.Mvc, so it redirect us on login screen. The cookie is different now for some reason. And that is my problem.

Thank you

Answer

I have all described cookies, domain is "localhost" everywhere.

So different ports = different domains?

According to SQL profiler, costructed query has __IsMayHaveTenantFilterEnabled_7 parameter.

It setted to 1, that is why the data were empty

INNER JOIN (
    SELECT [u].*
    FROM [AbpUsers] AS [u]
    WHERE (([u].[IsDeleted] = 0) OR ([u].[IsDeleted] <> 1 /*@__IsSoftDeleteFilterEnabled_4*/)) AND ([u].[TenantId] IS NULL OR (CASE
        WHEN CASE
            WHEN [u].[TenantId] IS NULL
            THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT)
        END = 1
        THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT)
    END = @__IsMayHaveTenantFilterEnabled_7 ))
) AS [t0] ON [t].[AbpUserId] = [t0].[Id]

<cite>ismcagdas: </cite> Hi @Ice2burn,

You souldn't use Entities in your Dtos. Probably there is a serialization problem while sending your list to client. Can you replace entities with their related Dtos in your TicketListDto class ? You can also check Logs.txt file under your web project to see if there is an error.

Hi, all Entities were replaces by related Dtos. An issue still exists. If i uncomment

.Include(p => p.User)

line, ticketRepository returns empty list.

Also, there is no errors or warnings in the Log.

Edited the code above according to my changes.

<cite>alirizaadiyahsi: </cite> Hi @Ice2burn,

Are you getting only users? What about other relations (tenant, product, etc...)?

Hi, I'm gettin no data at all if users included.

Showing 1 to 9 of 9 entries