Base solution for your next web application

Activities of "eggersa"

Thank you. That seems to work for me ;). We will probably update to the latest version with the next big feature request. But that really depends on our client. Lets hope is willing to pay.

After a while of debugging I found the issue that was in fact already introduced with 0.9.0.0 as far as I'm concerned.

In 0.8.4 the Delete method in the EfRepositoryBaseOfTEntityAndTPrimaryKey is implemented like this:

public override void Delete(TEntity entity)
        {
            AttachIfNot(entity);

            if (entity is ISoftDelete)
            {
                (entity as ISoftDelete).IsDeleted = true;
            }
            else
            {
                Table.Remove(entity);
            }
        }

However, in the later version the method was for some reason changed to:

public override void Delete(TEntity entity)
        {
            AttachIfNot(entity);
            Table.Remove(entity);
        }

The Remove method of Table (DbSet) internally clears all foreign keys including my Owner property (foreign key) which is marked as required. However, the SoftDelete logic later on modifies the entity and prevents its actual deletion which of course causes a validation and the results in a validation exception.

Is there any chance to workaround this issue?

Please do not take any offense on the following (I do a lot of erros myself and I love your framework anyway), but so far with every update was a new bug introduced that caused painful conversations with our client. Therefore I cannot afford another update.

0.8.4 -> 0.9.0 Bug and the Delete bug 0.9.0 -> 0.9.1.1 Bug

After I updated ABP from 0.8.4 to 0.9.3 I get an error when I try to delete an entity. I never run into this issue with the previous version of ABP. The error message says "The OwnerId field is required.". However, the OwnerId field is set as the following screenshot shows:

The property is defined as follows:

[Required]
        public long? OwnerId { get; set; }

        public virtual User Owner { get; set; }

Looking forward for your help.

Stack Trace

at System.Data.Entity.Internal.InternalContext.SaveChangesAsync(CancellationToken cancellationToken) at System.Data.Entity.Internal.LazyInternalContext.SaveChangesAsync(CancellationToken cancellationToken) at Abp.EntityFramework.AbpDbContext.<SaveChangesAsync>d__34.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\AbpDbContext.cs:line 201 --- 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.EntityFramework.Uow.EfUnitOfWork.<SaveChangesInDbContextAsync>d__23.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 209 --- 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.EntityFramework.Uow.EfUnitOfWork.<SaveChangesAsync>d__14.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 80 --- 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.EntityFramework.Uow.EfUnitOfWork.<CompleteUowAsync>d__16.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp.EntityFramework\EntityFramework\Uow\EfUnitOfWork.cs:line 97 --- 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.Domain.Uow.UnitOfWorkBase.<CompleteAsync>d__56.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkBase.cs:line 255 --- 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.Domain.Uow.UnitOfWorkInterceptor.<>c__DisplayClass5_0.<<PerformAsyncUow>b__0>d.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Domain\Uow\UnitOfWorkInterceptor.cs:line 68 --- 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.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 40 --- 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.<AwaitTaskWithFinally>d__0.MoveNext() in D:\Halil\GitHub\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs:line 20 --- 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.<CastToObject>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.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 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 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()

Hello

Thank you imscagdas for your answer. Actually, just deleting the database entry is not enough. You have also to clear the cache with wich I had some issues. Later on I found out how to get and clear the cache. It would be nice to have some Invalidate() function on the cache to make life easier in those situations.

Setting the setting value to the default value in order to delete the setting value from database and cache seems somewhat intransparent and implementation specific. The ISettingManager interface does not specify such behaviour.

My application provides application level smtp settings for sending emails. However, the user is able to override those settings by applying his own user level settings. At some point the user might like to not use his own settings anymore but fallback to the application setting values. To do that, I would like to delete those user level values for a given user.

How can I delete a user level setting using abp 0.9.3, such that I get the application level setting upon executing GetSettingValue(...) aftwards?

Hi.

Turned out it was a bug in the framework that was addressed in the later version 0.9.3. After I did update to this version the problem was solved.

Hello

I got an error after I updated from 0.8.4 to 0.9.1.1 I did not have before:

When I invoke the following method:

public async Task CreateEvent(EventEditDto input)
        {
            var @event = input.MapTo<Event>();
            @event.Attendees = new List<User>();

            for (int i = 0; i < input.AttendeeIds.Length; i++)
            {
                var attendee = await UserManager.FindByIdAsync(input.AttendeeIds[i]);
                @event.Attendees.Add(attendee);
            }

            await _eventRepository.InsertAsync(@event); // exception here
        }

I get the error

An entity object cannot be referenced by multiple instances of IEntityChangeTracker.

I get a similar error when I invoke

var entries = ChangeTracker.Entries().ToList();

in my override of ApplyAbpConcepts() in the MyCompanyDbContext class.

The relationship between the two objects cannot be defined because they are attached to different ObjectContext objects.

Obviously there are now multiple DbContexts. How can I handle this properly? Looking forward for your help and thank you in advance ;).

I ran into a rather strange issue when I try to query an entity using an IRepository with ABP 0.9.0. The exception says:

The UPDATE statement conflicted with the FOREIGN KEY constraint "FK_dbo.AbpTenants_dbo.AbpUsers_LastModifierUserId". The conflict occurred in database "PremiumHomes", table "dbo.AbpUsers", column 'Id'. The statement has been terminated.

And according to the error output the cause for this issue is the following method:

public virtual async Task<Customer> FindByNameAsync(string userName)
{
	return await _customerRepository.FirstOrDefaultAsync(customer => customer.UserName == userName);
}

However, I do not get what a select statement has to do with an update statement? What could be the actual source of this problem?

Edit: I did not run into this issue when I was using ABP 0.8.4.

Question

In the template of the ASP.NET Zero solution are two folders with 3rd party libraries. One is the Scripts folder that comes with every new ASP.NET MVC solution and the other one is the libs folder. Both of them contain a lot of different libraries. I couldn't make a proper distinction why some libraries are in the Scripts and other in the libs folder? Can someone explain me the concept behind those two seperate folders?

I would like to change the scope of EmailSettings to support user level settings. How can I do that using version 0.8.4 of ASP.NET Boilerplate? I noticed that you can do that in newer versions with the SettingDefinitionProviderContext. However, in version 0.8.4 this class is empty. Unfortunately updating a running system to a new version is too much of a risk.

Thank you in advance.

Showing 1 to 10 of 35 entries