Base solution for your next web application

Activities of "chrisk"

Hi,

I'd like to ask how is that achieved in Abp that without adding controllers or routes it is possible to serve .cshtml files to client like '/App/Main/views/tenants/index.cshtml' Or in fact it does something similar to dynamic web api controller builder ?

I'm really curious and it would be handy to know how to apply it to projects that can not use Abp.

Hi,

I'm trying to execute some code as separate transaction inside UoW method. Basically I got IApplicationService which receives some order data and then selects appropriate workflow to execute. Workflows are created in a way so those can be easily turned into background job. but at the moment I'm executing them within my AppService method so there is already UoW applied right?

What I need to do now is to capture errors that are occurring and send email notification. I implemented email notifications using AbpNotifications. My problem is that I want to rollback all changes that were generated within workflow execution then publish notification and rethrow any errors from my workflow so those will be logged and displayed on UI.

Than you very much

Hi,

I really like idea Abp implementation of certain concepts like IMustHaveTenant. I'm trying to implement something similar. I have created IMustHaveSourceAccount interface and I want to implement logic that will always validate if entity that implements IMustHaveSourceAccount has SourceAccountId property set.

What I got so far is:

protected override void ApplyAbpConcepts() { //Apply our concepts first
ApplyOrdersConnectorConcepts();

        base.ApplyAbpConcepts();
    }

    protected virtual void ApplyOrdersConnectorConcepts()
    {
        var entries = ChangeTracker.Entries().ToList();
        foreach (var entry in entries)
        {
            switch (entry.State)
            {
                case EntityState.Added:
                    CheckMustHaveSourceAccountIdProperty(entry);
                    break;
            }
        }

    }

    protected virtual void CheckMustHaveSourceAccountIdProperty(object entityAsObj)
    {
        if (!(entityAsObj is IMustHaveSourceAccount))
        {
            return;
        }

        var entity = entityAsObj.As<IMustHaveSourceAccount>();
        if (entity.SourceAccountId == 0)
        {
            throw new AbpException("Can not set SourceAccountId to 0 for IMustHaveSourceAccount entities!");
        }
    }

My debugging indicates that there is problem when checking if entity is derived from IMustHaveSourceAccount. I got migrations code with seed data that is inserting few records including entities that derive from IMustHaveSourceAccount and deliberately set SourceAccountId = 0 which should throw exception.

Even when I changed method to throw exception if entity implements my interface nothing happens: protected virtual void CheckMustHaveSourceAccountIdProperty(object entityAsObj) { if (!(entityAsObj is IMustHaveSourceAccount)) { return; } throw new AbpException("Can not set SourceAccountId to 0 for IMustHaveSourceAccount entities!"); }

Throwing exception before If block works so my method is getting called. Do you know what I'm doing wrong?

Thank you

Hi there,

I've got questions in regards to Token Authorization used in dynamic WebApi project. I'm able to successfully use WebApi and call authorized method once obtained token, however I don't know when and if token expires ? If so - how to check it ?

Thank you for all answers and suggestions.

Question

Hi there !

I started using EventBus in application and I'm using my DomainServices in IEventHandler<T> implementations. Thing is that all methods in my DomainServices are async using TPL.

Since handlers are non async void and I don't want to try adding async keyword to signature since its considered as very bad practice, what would you normally do in that case ?

  • I create non async version of methods that I need?
  • Use AsyncHelper.RunSync() ? how robust this solution is?
  • Other approach ?

All comments will be appreciated :)

Showing 1 to 5 of 5 entries