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

Activities of "bilalhaidar"

Any help pls?

Thanks

Answer

Thanks Ismail.

Hi Ismail,

At line 59, I am using

using (UnitOfWorkManager.Current.SetTenantId(AbpSession.TenantId.Value))

The data I am retrieving must have a Tenant. But, I need to access it from Host.

Thanks Bilal

But my AppService/DomainService are async. So I should await on something.

Any idea? Thanks

Hi Ismail,

It is more like I need to show data from multiple sites to a host user, so permissions might work well.

I created a Permission that is available in both Site and Host and seems to do the trick :)

Thanks Bilal

Hi, I always find difficulty in using .Include() in methods inside DomainServices especially when the method is defined as async.

I tend to use:

var shelter = await Task.FromResult(_repository.GetAllIncluding(s => s.ParentShelter).FirstOrDefault(s => s.Id == id));

Is it the right way? Or there is a better one?

Thanks Bilal

Hi, In an AppService, I am getting from Database a list of entities that implement IMustHaveTenant.

The following code is throwing an exception:

[UnitOfWork]
        public async Task<PagedResultDto<PocListDto>> GetPocs(GetPocsInput input)
        {
            // Build query
            var query = CreatePocRegisterQuery(input);

            // Apply filter if any
            query = query
                .WhereIf(
                   !string.IsNullOrEmpty(input.Filter),
                   poc =>
                       poc.FirstName.ToLower().Contains(input.Filter.Trim().ToLower()) ||
                       poc.LastName.ToLower().Contains(input.Filter.Trim().ToLower())
               );

            int pocCount;
            List<PersonofConcern> pocs;
            using (UnitOfWorkManager.Current.SetTenantId(AbpSession.TenantId.Value))
            {
                // Execute the query
                pocCount = await query.CountAsync();
                pocs = await query.OrderBy(input.Sorting).PageBy(input).ToListAsync();
            }

            // Convert to Dtos
            var pocListDtos = pocs.MapTo<List<PocListDto>>();

            return new PagedResultDto<PocListDto>(
                pocCount,
                pocListDtos);
        }

Exception:

ERROR 2017-04-23 20:10:42,681 [10   ] nHandling.AbpApiExceptionFilterAttribute - Nullable object must have a value.
System.InvalidOperationException: Nullable object must have a value.
   at System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
   at System.Nullable`1.get_Value()
   at Drc.OnlineSystems.Drc.Sms.PersonofConcernAppService.&lt;GetPocs&gt;d__7.MoveNext() in ...\PersonofConcernAppService.cs:line 69
--- 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 Abp.Threading.InternalAsyncHelper.&lt;AwaitTaskWithPostActionAndFinallyAndGetResult&gt;d__5`1.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 Abp.Threading.InternalAsyncHelper.<AwaitTaskWithFinallyAndGetResult>d__3`1.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.Threading.Tasks.TaskHelpersExtensions.&lt;CastToObject&gt;d__3`1.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.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.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 Abp.WebApi.Uow.AbpApiUowFilter.<ExecuteActionFilterAsync>d__5.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 Abp.WebApi.Validation.AbpApiValidationFilter.<ExecuteActionFilterAsync>d__5.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 Abp.WebApi.Auditing.AbpApiAuditFilter.<ExecuteActionFilterAsync>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.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.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 Abp.WebApi.Security.AntiForgery.AbpAntiForgeryApiFilter.<ExecuteAuthorizationFilterAsync>d__10.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 Abp.WebApi.Authorization.AbpApiAuthorizeFilter.<ExecuteAuthorizationFilterAsync>d__7.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.Web.Http.Controllers.AuthenticationFilterResult.<ExecuteAsync>d__0.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.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()
ERROR 2017-04-23 20:11:34,029 [23   ] nHandling.AbpApiExceptionFilterAttribute - Nullable object must have a value.

Maybe I didn't explain myself correct.

I want to use a Razor For Loop to loop over data just as we do it when using MVC Model/Views. This is similar to the case when you call an MVC Controller Action that returns a View with a Model.

The reason why I need this is because I need to get render form controls dynamically. So I would get a model of all fields to render, then one by one I embed an angular directive corresponding to that field.

I would rather do that in Razor server-side rather than Angular as I read everywhere I shouldn't be doing DOM manipulation through the angular controller.

Let me know if it is clear now, if not I will do more effort to explain.

Thanks Bilal

Hello, I have an AppService that is managed by Tenant-Level permissions.

How can I allow Host-Level users to access that AppService, as per Abp.

Thanks Bilal

Thank you.

But I see a lot of use for the SetTenantId(Null) in the Framework code, how come it works? Aren't they checking permissions too?

But how would I solve such an issue? What's the recommendation?

I am getting data from host and tenant, at the same time, I have permissions so that not everyone can access the data.

Thank you Bilal

Showing 311 to 320 of 635 entries