Base solution for your next web application

Activities of "sagreven"

Answer

This is a service function. So nothing special. The commentend function shows the workaround.

Edit: I think I have a general problem with the UOW because I also discovered in other functions that it's not possible to disable filter. How can I debug this? I tried to disable the IMustHaveTenant filter but than while debugging the table is even not resolveable in the debugger mode.

[UnitOfWork]
		public async Task AddToRole(long userId, string roleName, int? tenantId)
		{
			if (tenantId == null)
				CheckErrors(await _userManager.AddToRoleAsync(userId, roleName));
			else
			{
				using (_unitOfWorkManager.Current.SetFilterParameter(AbpDataFilters.MayHaveTenant, AbpDataFilters.Parameters.TenantId, tenantId))
				{
					// Todo: Temporary fix
					//var role = await _roleManager.GetRoleByNameAsync(roleName);
					//if (await _userRoleRepository.FirstOrDefaultAsync(x => x.RoleId == role.Id && x.TenantId == (int)tenantId) != null)
					//	throw new UserFriendlyException("Permission already assigned.");
					//await _userRoleRepository.InsertAsync(new UserRole(tenantId, userId, role.Id));
					await _sessionAppService.ResetAllCaches();
					CheckErrors(await _userManager.AddToRoleAsync(userId, roleName));
				}
			}
		}
Question

Perhaps it's a question which is handled more often. But I'm not sure what happened:

  • I just upgrade to Abp v1.5.1 using NuGet

First issue:

I have the following code:

using (_unitOfWorkManager.Current.DisableFilter(AbpDataFilters.MayHaveTenant))
{
	if (await _userManager.UserExist(feed.UserId))
	{
		user = await _userManager.GetUserByIdAsync(feed.UserId);

The function is declared as

[UnitOfWork]
public async Task<IEnumerable

Get UserByIdAsync gives me an disposed error while _userMananger.UserExist runs fine.

Second issue: My code looks like the following:

using (_unitOfWorkManager.Current.SetFilterParameter(AbpDataFilters.MayHaveTenant, 
     AbpDataFilters.Parameters.TenantId, tenantId))
				{

					CheckErrors(await _userManager.AddToRoleAsync(userId, roleName));

The function is defined as

[UnitOfWork]
		public async Task AddToRole

Here I'm getting the error that the user is already taken ;) ;) Inserting manually the role works as expected.

I think i missed something important but I can't figured out what it is

Please help

Thanks.

For the first issue: I also replaced everything to the then semantics.

For the second issue: You also right. Changed all links to use !/

Thx for the tip.

Hi,

I upgraded verything from ABP from 1.0.0 to 1.3.1. I also update some other packages (in fact all). However I ran into the dynamics problem and went back to 1.4.11 as suggested. Still two problems left:

Problem 1: I got an error that the success methoda as schon here (<a class="postlink" href="http://aspnetboilerplate.com/Pages/Documents/Dynamic-Web-API">http://aspnetboilerplate.com/Pages/Docu ... ic-Web-API</a>) is not working and then I came on the brilliant idea changing all the code to the suggested solution I found here (<a class="postlink" href="https://docs.angularjs.org/api/ng/service/$http">https://docs.angularjs.org/api/ng/service/$http</a>); shortly using .then with callbacks. This is working fine instead that the result is not the "pure" data i got before but is now the complete ajax request. Is this intented to be or did I miss something?

Problem 2: Non of my route links are working any more. When I try to navigate to /#/users i got redirected to /#!/. Perhaps this also has to do with my update competition. But currently I'm to tired to find the solution :( :( :( :( . I changed nothing in the app.js so I guess this should still works fine. I also get no errors exept of one but I got this one on all my solutions but the rest are still working. so i guess this is not an issue.

Does anyone can help me at least on the right way?

Showing 1 to 4 of 4 entries