Hi, I've the same requirement as this topic [https://forum.aspnetboilerplate.com/viewtopic.php?f=5&t=10262]) but with default repository.
I've a context but I don't need a custom repository and so "override int SaveChanges()" is not raised on my context. How can I catch DbUpdateConcurrencyException on default repository to show a UserFriendlyException?
Thank you.
I reply to myself.
After looking to Abp.EntityFrameworkCore.Test and BlogUrlChangeEventData I realised that Aggregate's DomainEvents are raised only if the Aggregate itself is updated by a repository.
So, as my Domains Entities are unaware of persistence, I have to use EventBus directly.
Hi, I'm using DDD and in my class that inherits AggregateRoot I use DomaniEvents:
DomainEvents.Add(new CambioCredenzialiEventData(){Email = email});
and the relative handler:
public class CambioCredenzialiEventHandler : IEventHandler<CambioCredenzialiEventData>, ITransientDependency
{
public void HandleEvent(CambioCredenzialiEventData eventData){
...........
}
}
In Module Initizialize assembly is registered with
IocManager.RegisterAssemblyByConvention(typeof(MyDomainModule).Assembly);
When the ApplicationService ends his work and repository save the data, nothing happens and the EventHandler is not called. But if I use the EventBus in the ApplicationService, the handler is called.
EventBus.Trigger(new CambioCredenzialiEventData() { Email = input.Email });
Note that if I check MyClass.DomainEvents.Count the result is 1 as expected; What I'm missing to work with DomainEvents ?
Thank you
Hi, some news for my tests?
Have you checked my code?
Thanks
Hi, I've created a generic interface with implementation:
public interface IAggregateRepository<T, in TPrimaryKey> : ITransientDependency where T : IAggregateRoot
...
public class ConfigurazioneRepository : IAggregateRepository<Configurazione,long>
....
When I try to inject IAggragateRoot<Configurazione, long>, Castle says that it has dependencies to be satisfied and is waiting for the following dependencies.
But if I register it manually it works.
IocManager.Register<IAggregateRepository<Configurazione, long>, ConfigurazioneRepository>(DependencyLifeStyle.Transient);
The question is: how can I register a generic interface like IRepository<T> ?
Thanks
Email sent to <a href="mailto:[email protected]">[email protected]</a>
Thanks.
Hi @ismcagdas, some news for my problem ?
Yes sure. As I said, the module work pefectly. Only tests have problems. I've migrated it from core 1.1 where tests are executed correctly.
I would like to have also some guide on how create test with custom plugin modules .
Thanks
Hi, I'm trying to migrate my module tests to 5.0.4 Core 2 & Angular. Module porting was sucessfull and works, but I've some problems to migrate test. Can you give me some clarifications about testing new plugin module? The error is :
Castle.MicroKernel.Handlers.HandlerException : Can't create component 'Uno.DossierSanitario.Application.DossierSanitarioAppService' as it has dependencies to be satisfied.
'Uno.DossierSanitario.Application.DossierSanitarioAppService' is waiting for the following dependencies:
- Service 'Uno.DossierSanitario.EntityFramework.Repositories.DossierRepository' which was registered but is also waiting for dependencies.
'Uno.DossierSanitario.EntityFramework.Repositories.DossierRepository' is waiting for the following dependencies:
- Service 'Abp.EntityFrameworkCore.IDbContextProvider`1[[Uno.DossierSanitario.EntityFramework.EntityFramework.DossierSanitarioContext, Uno.DossierSanitario.EntityFramework, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`1[[Uno.DossierSanitario.Core.WriteModel.StateTypeData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`2[[Uno.DossierSanitario.Core.ReferenceModel.ProfileData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`2[[Uno.DossierSanitario.Core.ReferenceModel.OrganizationUnitData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null],[System.Int64, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`1[[Uno.DossierSanitario.Core.WriteModel.StateData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`1[[Uno.DossierSanitario.Core.WriteModel.WorkspaceData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'Abp.Domain.Repositories.IRepository`1[[Uno.DossierSanitario.Core.WriteModel.StateTypeData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
- Service 'Uno.DossierSanitario.Core.DossierDossierIdGenerator' which was registered but is also waiting for dependencies.
'Uno.DossierSanitario.Core.DossierDossierIdGenerator' is waiting for the following dependencies:
- Service 'Abp.Domain.Repositories.IRepository`1[[Uno.DossierSanitario.Core.WriteModel.DossierData, Uno.DossierSanitario.Core, Version=2.1.0.0, Culture=neutral, PublicKeyToken=null]]' which was not registered.
at Castle.MicroKernel.Handlers.DefaultHandler.AssertNotWaitingForDependency()
at Castle.MicroKernel.Handlers.DefaultHandler.ResolveCore(CreationContext context, Boolean requiresDecommission, Boolean instanceRequired, Burden& burden)
at Castle.MicroKernel.Handlers.DefaultHandler.Resolve(CreationContext context, Boolean instanceRequired)
at Castle.MicroKernel.DefaultKernel.ResolveComponent(IHandler handler, Type service, IDictionary additionalArguments, IReleasePolicy policy)
at Castle.MicroKernel.DefaultKernel.Castle.MicroKernel.IKernelInternal.Resolve(Type service, IDictionary arguments, IReleasePolicy policy)
at Castle.Windsor.WindsorContainer.Resolve[T]()
at Uno.DossierSanitario.Tests.DossierSanitarioTests..ctor() in c:\Uno\Production\Development\Development\Uno.2017\Products\Uno.DossierSanitario.Abp\test\Uno.DossierSanitario.Tests\DossierSanitarioTests.cs:line 23
Thanks
Thank you @ismcagdas,
Can you provide me a right way to migrate the previous settings to the new concept? Which interface or service should I use?
We have already used (and serialized in appsettings) the previous settings for every tenant, but they are changed (like UsePunctuations => RequireNonAlphanumeric) . Plus, we need to manually validate the password like the previous password checker because some users does not require restriction (eg. Service Account).
Thanks