Base solution for your next web application

Activities of "eggersa"

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()

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?

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.

Hello.

I have to introduce a second type of user. To do that I simply inherit from the User class und put all the type related properties in the specific subclass (using Table per Type Hierarchy) like so:

public abstract class User : AbpUser<Tenant, User>
{
	// ...
}

// example of a concrete user type
[Table("ApplicationUsers")]
public class ApplicationUser : User
{
	// ...
}

However, it does not seem possible using ASP .NET Zero based on Boilerplate 0.8.4 to have a specific UserManager for each user type as the Tenant class uses the abtract User class. And by the restrictions of the AbpUserManager, this does not allow me to combine ApplicationUser with the Tenant:

public abstract class AbpUserManager<TTenant, TRole, TUser> : UserManager<TUser, long>, IDomainService, ITransientDependency
        where TTenant : AbpTenant<TTenant, TUser>
        where TRole : AbpRole<TTenant, TUser>, new()
        where TUser : AbpUser<TTenant, TUser>
{
	// ...
}
// does not work
public class UserManager : AbpUserManager<Tenant, Role, ApplicationUser>
{
	// ...
}

Maybe there is a better solution to have different user types? Reimplementing the whole AbpUserManager does not seem appropriate.

I was wondering why every javascript code is wrapped in a function like this:

(function () {
   ...
}();

I have never seen this before. Maybe there is a good idea behind this to keep going with this practice?

Thank you for your answer!

It's not the first time I am asking this myself. However, since ASP.NET Boilerplate puts a lot of effort in further abstracting the database access with generic repositories I would like to ask about the reasoning behind this. Of course, the first argument that comes in everyones mind is unit testing. But lets be honest, most companies, and especially small ones don't write unit tests at all (since customers obviously won't pay for things they do not see). Is there any other point in using the repository pattern?

Since aspnetboilerplate automatically creates some of the javascript like Web API proxies, I was wondering if I can somehow inject my own javascript builder to create some javascript version of my C# enums to use on clientside?

Showing 1 to 10 of 23 entries