By the way is it correct to use 4.6.1 as target framework or I should stay on 4.5.1?
I tried... same error
I finally solved it!
First I discovered that it was not a problem of this piece of code alone:
foreach (var phone in phones)
{
if (phone.Id == 0)
{
{
var currentPartner = _partnerRepository.Get(partner.Id);
currentPartner.Phones.Add(phone);
// await CurrentUnitOfWork.SaveChangesAsync();
}
}
but of the interference with previous partner update:
var query = await _partnerRepository.UpdateAsync(partner);
each of the actions alone worked well, but they did not work together, I do not really know why, maybe because of interference between the collection partner.Phones and the separate addition of phones.
When I discovered that I took the following actions:
In that way everything works I can add as many phones I want, delete as many I want, edit as many I want and also edit the partner name and surname on the same page and everything get updated.
Thanks for the support!
To share what I did this is my app service now:
[AbpAuthorize(AppPermissions.Pages_Tenant_Partners_CreatePartner)]
public async Task EditPartner(EditPartnerInput input)
{
var partner = input.MapTo<Partner>();
var phones = input.Phones.MapTo<List<Phone>>();
var phonesToDelete = input.DeletedPhones.MapTo<List<Phone>>();
var phonesToAdd = input.AddedPhones.MapTo<List<Phone>>();
var query = await _partnerRepository.UpdateAsync(partner);
await CurrentUnitOfWork.SaveChangesAsync();
foreach (var phoneToAdd in phonesToAdd)
{
await _phoneRepository.InsertAsync(phoneToAdd);
// await CurrentUnitOfWork.SaveChangesAsync();
}
foreach (var phone in phones)
{
var phoneToUpdate = await _phoneRepository.GetAsync(phone.Id);
phone.MapTo(phoneToUpdate);
await _phoneRepository.UpdateAsync(phoneToUpdate);
}
foreach (var phoneToDelete in phonesToDelete)
{
await _phoneRepository.DeleteAsync(phoneToDelete.Id);
}
}
This the Dto:
using Abp.AutoMapper;
using Abp.Application.Services.Dto;
namespace stake.Partners.Dto
{
[AutoMapTo(typeof(Partner))]
public class EditPartnerInput : IInputDto
{
public int Id { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public PartnerPhoneDto[] Phones { get; set; }
public PartnerPhoneDto[] DeletedPhones { get; set; }
public PartnerPhoneDto[] AddedPhones { get; set; }
}
}
Hi,
I was working well with ABP 9.6. When 9.7 came out I upgraded the libraries and I could not login into the application. So I downgraded to 9.6, reinstalling the correct version of all the other packages. Now at every build I cannot login and I have to close Visual Studio and open again.
I find the following in the log:
WARN 2016-07-05 09:04:35,230 [12 ] Abp.Logging.LogHelper - Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
at Abp.Authorization.AuthorizeAttributeHelper.<AuthorizeAsync>d__13.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 29
--- 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 Nito.AsyncEx.AsyncContext.<>c__DisplayClass3.<Run>b__1(Task t)
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- 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 Nito.AsyncEx.AsyncContext.Run(Func`1 action)
at Abp.Authorization.AuthorizeAttributeHelper.Authorize(IEnumerable`1 authorizeAttributes) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 45
at Abp.Authorization.AuthorizeAttributeHelper.Authorize(IAbpAuthorizeAttribute authorizeAttribute) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 50
at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeAttribute.AuthorizeCore(HttpContextBase httpContext) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeAttribute.cs:line 41
Abp.Authorization.AbpAuthorizationException: Current user did not login to the application!
at Abp.Authorization.AuthorizeAttributeHelper.<AuthorizeAsync>d__13.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 29
--- 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 Nito.AsyncEx.AsyncContext.<>c__DisplayClass3.<Run>b__1(Task t)
at System.Threading.Tasks.ContinuationTaskFromTask.InnerInvoke()
at System.Threading.Tasks.Task.Execute()
--- 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 Nito.AsyncEx.AsyncContext.Run(Func`1 action)
at Abp.Authorization.AuthorizeAttributeHelper.Authorize(IEnumerable`1 authorizeAttributes) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 45
at Abp.Authorization.AuthorizeAttributeHelper.Authorize(IAbpAuthorizeAttribute authorizeAttribute) in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Authorization\AuthorizeAttributeHelper.cs:line 50
at Abp.Web.Mvc.Authorization.AbpMvcAuthorizeAttribute.AuthorizeCore(HttpContextBase httpContext) in D:\Halil\GitHub\aspnetboilerplate\src\Abp.Web.Mvc\Web\Mvc\Authorization\AbpMvcAuthorizeAttribute.cs:line 41
Can you give me a way out?
Thanks
By the way, when I close and restart Visual Studio and build the solution the system do not even ask me to log in! I am already in.
Hi,
now I discovered that I do not need to restart Visual Studio. It sufficient to stop the local web server. Something dirty is around. When I publish the solution everything is ok, so it is in the local web chain. I can live with that currently... I will try to understand.
I cleaned the browser cache multiple times but no avail.
Regards
I am working on a single project, also if I created multiple copies of it in the past.
Now it works this way. First build, required access, ko; stop express server, buld again ok, no need for access.
Hi,
I downloaded the last template of AbpZero and upgraded the abp packages but I get the following error
Error CS7036 There is no argument given that corresponds to the required formal parameter 'multiTenancy' of 'ClaimsAbpSession.ClaimsAbpSession(IPrincipalAccessor, IMultiTenancyConfig, ITenantResolver, IAmbientScopeProvider<SessionOverride>)'
Can you advise?
Thanks
Perfect!
Changed:
public AspNetZeroAbpSession(IMultiTenancyConfig multiTenancy)
: base(multiTenancy)
{
}
to:
public AspNetZeroAbpSession(
IPrincipalAccessor principalAccessor,
IMultiTenancyConfig multiTenancy,
ITenantResolver tenantResolver,
IAmbientScopeProvider<SessionOverride> ambientScopeProvider)
: base(principalAccessor, multiTenancy, tenantResolver, ambientScopeProvider)
{
}
and it works!
Thanks for your prompt reply!