Base solution for your next web application

Activities of "enio"

Answer

Hi epicadmin,

have you been successful in setting up windows authentication? Unfortunately it seems that aspnetzero indeed ignores this important business scenario. I haven't found any useful documentation about that.

If you were successful I would be very happy if you could write down some words about what you have done.

Kind regards, marco

Hi ismagdas

I see that there is currently no matching hook/event available in entity framework or abp. It seems a bit strange to me that apparently there is no need for that.

kind regards, marco

Hi @ismcagdas

Thank you for your hint with the computed column. I already checked out this approach but unfortunately this does not work with Dependency Injection.

Kind regards, marco

Hi @musa.demir

Thank you for your hint with the entity-changes events. Unfortunately I am looking for an event which is triggered when I query the data and such a predefined event does not exists. EntityCreatingEventData<>-Event is triggered when a new entity is inserted into the database not when a new entity object was created with data from the database.

Does anyone have another approach?

Thank you very much! Everything is no working as expected and I can validate the access to my DevExpress Dashboard.

The problem is definitely the missing Authorization header. As soon as I send the get request with postman and add the authorization-header I have the correct user identity... now I have to find a way to modify the dashboard in the frontend to always send the authorization token. Is there a simple way in the angular frontend to get the Authorization token?

Hi @ismcagdas

The debug point will be hit when I send a request for the first time to the dashboard controller.

I have prepared a screencast for you: https://vimeo.com/403304170/35029fcf0d

You can actually directly access the server where I have taken the screencast from either by windows remote desktop or teamviewer. How can I pass you the secret credentials?

I have just realized that the requests which are sent by the dashboard component to the backend do not have the authentication header. Therefor it is actually clear that the backend can't recognize the user... I guess that I have to fix the problem on the frontend.

Regards, marco

Hi Velu, although this post is now closed I hope that you still receive my request. Could you please send some sample code to [email protected]?

This is the Context: https://download.enio.ch/PEPDVPXM/web_managerDbContext.cs ..it's actually the original AspNetZero context

This is our repository:

public class InvoiceRIrTaskRepository : web_managerRepositoryBase<IrTask>, IInvoiceRIrTaskRepository
{
    public InvoiceRIrTaskRepository(IDbContextProvider<web_managerDbContext> dbContextProvider) : base(dbContextProvider)
    {
    }

    public async Task UpdateIrTaskGraph(IrTask task)
    {
        task.IrCase.Documents = new List<Document>();

        Context.Update(task);
        Context.SaveChanges();
    }
}

This is our repositories interface:

public interface IInvoiceRIrTaskRepository : IRepository<IrTask>
{
    Task UpdateIrTaskGraph(IrTask task);
}

And this is the base repository - actually the original file as we found it in AspNetZero 6.7

    /// <summary>
    /// Base class for custom repositories of the application.
    /// </summary>
    /// <typeparam name="TEntity">Entity type</typeparam>
    /// <typeparam name="TPrimaryKey">Primary key type of the entity</typeparam>
    public abstract class web_managerRepositoryBase<TEntity, TPrimaryKey> : EfCoreRepositoryBase<web_managerDbContext, TEntity, TPrimaryKey>
        where TEntity : class, IEntity<TPrimaryKey>
    {
        protected web_managerRepositoryBase(IDbContextProvider<web_managerDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        //add your common methods for all repositories
    }

    /// <summary>
    /// Base class for custom repositories of the application.
    /// This is a shortcut of <see cref="web_managerRepositoryBase{TEntity,TPrimaryKey}"/> for <see cref="int"/> primary key.
    /// </summary>
    /// <typeparam name="TEntity">Entity type</typeparam>
    public abstract class web_managerRepositoryBase<TEntity> : web_managerRepositoryBase<TEntity, int>
        where TEntity : class, IEntity<int>
    {
        protected web_managerRepositoryBase(IDbContextProvider<web_managerDbContext> dbContextProvider)
            : base(dbContextProvider)
        {

        }

        //do not add any method here, add to the class above (since this inherits it)!!!
    }

The context I am using is comming from the base class EfCoreRepositoryBase and provided to this base class in the base call of my constructor. My constructor gets the context injected:

IDbContextProvider&lt;web_managerDbContext> dbContextProvider

Yes the change is audited. The concerning entity class has the [Audited]-annotation on class level and the class is listed in EntityHistoryHelper. When I update the entity with the default abp IRepository<myEntity> everything is working just fine. But as soon as I update the entity with the context from my custom repository the changed entities are not detected / not listed in the AbpEntityPropertyChanges table.

Showing 1 to 10 of 15 entries