Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "DennisAhlin"

Ok, good to know. Thank you!

In a test class in the TestModule.

Yes, this is true. I will use injection instead. But isn't it still weird that it doesn't work if I would have had a static factory that required the static Instance?

Because this Factory is overridden by multiple other factories, so there is much more code in form of constructors to add and maintain. Why would I not use it (except that it doesn't work)?

I get this problem too.

public class ComponentsInstaller : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store){
        container.Register(Component.For<ICustomerConnector>().ImplementedBy<CustomerConnector>().LifestyleTransient());
    }
}

MyCoreModule:
public override void Initialize()
...
//Here it works
var connector = IocManager.Resolve<ICustomerConnector>();
}

CustomerConnectorFactory : MyServiceBase
    readonly IWindsorContainer _container;

    public CustomerConnectorFactory(IWindsorContainer container)
    {
        _container = container;
    }

    public ICustomerConnector Create() {
        //This works!
         var conn = _container.Resolve<ICustomerConnector>();
    
        //This breaks with ComponentNotFoundException
        var connector = IocManager.Instance.IocContainer.Resolve<ICustomerConnector>();
        return connector;
    }
    
    
    
    
    

Is there any way of logging the SQL from the query?

Yes, I can use EnsureCollectionLoaded in this example where I use single. However if I want to select multiple parents I have to do like this? Which I assume is terrible performance wise?

var query = _parentsRepository
    .GetAll()
    .Where(p => *somePredicate*)
    .ToArray();

foreach (var parent in parents)
{
    await _parentsRepository.EnsureCollectionLoadedAsync(parent, p => p.Children);
}

After plenty of Googling and checking their issues I have not found anything that can help me.

The child have IMustHaveTenant because two different tenants should be able to see the Parent, but they should only see the Children they have created. Maybe there is another way of solving this?

Is there any way of logging the SQL from the query?

Ah, nice! Thank you for your help! :)

So, basically I have to do this:

public class MyDbContext : AbpZeroDbContext<Tenant, Role, User, MyDbContext>, IAbpPersistedGrantDbContext
{
     ...
    public override int SaveChanges()
    {
        var deletedIntegrations = ChangeTracker.Entries<Integration>()
            .Where(j => j.State == EntityState.Deleted)
            .Select(e => e.Entity)
            .ToArray();

        foreach (var deletedIntegration in deletedIntegrations)
        {
            IntegrationSteps.Remove(e => e.IntegrationId == deletedIntegration.Id);
        }

        return base.SaveChanges();
    }
}

Any suggestions on how to do this more maintainable?

The integration entity gets soft deleted, but not the steps (they are untouched). Aren't cascading of soft deletion implemented in Boilerplate?

Showing 1 to 10 of 25 entries