Migrating Normal MVC5 DB First Solution to ABP
See original GitHub issueHello dear @ismcagdas , @hikalkan , @alirizaadiyahsi , @yekalkan
As I have worked with ASP.NetZero in my previous company, I know the benefits of this amazing framework. A great appreciation to the ABP Team for that.
Now I suggested ABP in my current company also. But our application is already been developed for over last one year in MVC5(DB-First) with EntityFramework and Kendo-UI .
But I managed to migrate the whole project to the latest ABP template(v3.9.0 at that time) for ASP.NET MVC & jQuery. My ORM also changed to EF Code-First.
I migrated all the codes as it is. Only done some configuration changes and all. ie, my existing code doesn’t use ABP’s AppServices(But I had an independent service layer) and Repositories. Purely Linq and EF only. But All my controllers are extends to ABPControllerBase. It is impossible to change the whole existing code to the conventional ABP architecture. But my further developments will be as per the system.
Currently the application is working fine with all the features including KendoUI. But the only problem is DELETE functionality is making the trouble!! All other Create, Read and Update is works like a charm.
I have tried EF’s RemoveRange & Remove methodes. It returns the following error:
at Abp.EntityFramework.AbpDbContext.IsHardDeleteEntity(DbEntityEntry entry) at Abp.EntityFramework.AbpDbContext.ApplyAbpConceptsForDeletedEntity(DbEntityEntry entry, Nullable1 userId, EntityChangeReport changeReport) at Abp.EntityFramework.AbpDbContext.ApplyAbpConcepts(DbEntityEntry entry, Nullable1 userId, EntityChangeReport changeReport) at Abp.EntityFramework.AbpDbContext.ApplyAbpConcepts() at Abp.EntityFramework.AbpDbContext.SaveChanges() at ABM.Application.SRV.SRVService.CreateOrUpdate(IEnumerable1 items, Int64 srvMasterId, DateTime date, Nullable1 poMasterId, Int32 poRevisionNo, String pRNumbers, Int32 supplierId, String project, Nullable1 workOrderId, String dNNo, String dNFileName, String invoiceNo, String invoiceFile, DateTime receivedOn, String remarks, Decimal receivedStockValueCur, Decimal receivedStockValueQAR, Boolean isSubmitted, Int64 userId, Boolean isCashSRV) in G:\To Shihab\Sources\ABM_abp\ABM.Application\SRV\SRVService.cs:line 188
My table is not having an IsDeleted column and not extends to ABP’s Base Entity class. Just a DBSet in ABPDBContext, that’s all.
Then I tried by creating an IRepository for the entity by extending it to ABP’s BaseEntity Class. But as I am doing the CRUD in my service layer, it is not accessible from the controller. Because I failed to invoke the service class with the Constructor Injection of IRepository.
Now I’m stuck!! Please help me to complete the mighty ABP integration to my application. This is the one and only obstacle to finish the integration.
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
@sayassyk try:
@sayassyk for now you can override IsHardDeleteEntity method of your DbContext and return false for your own entities.
We will check and fix this in ABP.