Base solution for your next web application

Activities of "Siyeza"

Hi,

ABP version is 5.6 Base framework is .NET Core

I have an ApplicationService with the following method:

/// <summary>
        /// Submits the specified item to the workflow
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>                      
        public async Task SubmitAsync(ItemActionRequestDto request)
        {
            Guard.ArgumentNotNull(request, nameof(request));      

            using (var unitOfWork = UnitOfWorkManager.Begin(TransactionScopeOption.Suppress))
            {
                // Map the request
                var workflowRequest = ObjectMapper.Map<ItemActionRequest>(request);
                workflowRequest.UserId = AbpSession.UserId.Value;

                // Submit the item to the workflow
                var workflow = await ItemWorkflowFactory.CreateAsync(workflowRequest);
                await workflow.SubmitAsync(workflowRequest);

                unitOfWork.Complete();
            }
        }

The workflow.SubmitAsync call will eventually call the following DomainService method:

/// <summary>
        /// Creates the workflow item for the specified Item
        /// </summary>
        /// <param name="item"></param>                
        public virtual void CreateWorkflowItem(TItem item)
        {
            Guard.ArgumentNotNull(item, nameof(item));

            using(var unitOfWork = UnitOfWorkManager.Begin(TransactionScopeOption.Required))
            {
                // Check if workflow item already exists
                var workflowItem = WorkflowItemRepository.FirstOrDefault(w => w.ItemRef == item.Id);
                if (workflowItem != null)
                {
                    throw new InvalidOperationException(string.Format(InternalMessages.Workflow_ItemAlreadyExists, item.Id));
                }

                // Create workflow item
                workflowItem = new WorkflowItem
                {
                    ItemRef = item.Id,
                    ItemType = item.ItemType,
                    ItemSubTypeCode = item.ItemSubTypeCode,
                    ItemSubTypeName = GetItemSubTypeName(item),
                    ItemAction = item.ItemAction,
                    TenantId = item.TenantId,
                    Trigger = WorkflowTrigger.None,
                    State = WorkflowState.NotStarted
                };

                // Get the route for the item
                var routingManager = GetRoutingManager(item);
                workflowItem.RouteItemTypeCode = routingManager.Route.ItemTypeCode;

                // Save the item
                item.WorkflowItem = workflowItem;
                ItemRepository.Update(item);


                unitOfWork.Complete();
            }

           
        }

The changes made in this inner UnitOfWork will not reflect in the DB until the outer UnitOfWork (created with TransactionScopeOption.Suppress) has completed.

Thanks

Hi,

I have a long running operation that creates a unit of work using UnitOfWorkManager.Begin(TransactionScopeOption.Suppress) in order to prevent table/row locks.

Inside this unit of work I have operations that create their own unit of works, either via the UnitOfWork attribute or via the UnitOfWorkManager. I've noticed two things:

  1. The inner unit of works seem to inherit TransactionScopeOption.Suppress as well., Methods with the UnitOfWork attribute will inherit TransactionScopeOption.Suppress.
  2. An inner unit of work created with UnitOfWorkManager.Begin(TransactionScopeOption.Require) has to wait for outer unit of work, created with TransactionScopeOption.Suppres, to complete before it's changes are committed

The behaviour of 2) seem wrong to me.

An inner unit of work started with UnitOfWorkManager.Begin(TransactionScopeOption.Required) should commit changes immediately when it has completed, regardless if the outer unit of work was created with TransactionScopeOption.Suppress.

Thanks

Thank you

Thank you

Hi,

We have a requirement to host some of our modules into their own Docker containers in order to achieve a microservice architecture. Some of these modules will expose their services as Rest APIs.

Assume the user has logged via the Web Host application. The user performs some operation that intiates a service call to one of these microservices.

Will the Web Host pass the relevant authorization and tenant headers to the microservice when performing the service request? If so, will the microservice be able to the perform the standard ABP authorization checks, such as checking roles and permissions?

Thanks

Hi,

What is the recommended way for deternining the current Tenant for domain service operations that operate on tenant specific data? Should I rely on AbpSession being populated with current TenantId or should I explicitly specify the TenantId as a parameter in the domain service requests, and use CurrentUnitOfWork.SetTenantId()?

Thanks

Thank you, this helped. I had tried it before maybe I was doing something else wrong. Thanks again.

I am trying to run the web.host project using the dotnet core command as above. My issue I am getting that 0.0.0.0:port - instead of localhost:port.

Do you guys know how can I do this?

Thank you

Hi,

I have a requirement to extend user registration. Users will be required to select a Profile Type when registering. Profile Type is an entity that links to a set of Roles. The user will be be granted a default set of roles depending on their profile type. For example, the "Student" profile type will grant users the roles configured for that profile type. Tenant Admin can maintain which roles are granted to each profile type.

Basically, I need this to work the same way roles work for organizational units.

What is the easiest way that I can extend the ABP role / authorization provider to include the roles from profile type? Is there anything else I need to do for authorization / permission checks?

Thanks

Showing 11 to 20 of 113 entries