question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrating Normal MVC5 DB First Solution to ABP

See original GitHub issue

Hello 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:closed
  • Created 5 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
malimingcommented, Jan 29, 2019

@sayassyk try:

protected override bool IsHardDeleteEntity(DbEntityEntry entry)
{ 
      return true;
      // check your entities here... 
      // return base.IsHardDeleteEntity(entry);
}
1reaction
ismcagdascommented, Jan 28, 2019

@sayassyk for now you can override IsHardDeleteEntity method of your DbContext and return false for your own entities.

protected override bool IsHardDeleteEntity(EntityEntry entry)
{
	// check your entities here...
	return base.IsHardDeleteEntity(entry);
}

We will check and fix this in ABP.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Migrating from ASP.NET Boilerplate to the ABP Framework
So, this guide respects to that layering model and explains the migration layer by layer. Creating the Solution. First step of the migration...
Read more >
getting started running solution | Documentation Center | ABP.IO
The solution uses the Entity Framework Core Code First Migrations. It comes with a .DbMigrator console application which applies the migrations and also...
Read more >
ABP Framework — Web Application Development Tutorial ...
UI=MVC&DB=EF 00:00 Introduction 01:07 Creating the solution 02:32 ... Book Entity to a Database Table 16:20 Add Database Migration 17:20 Add ...
Read more >
Tutorial: Use EF Migrations in an ASP.NET MVC app and ...
Execute the first migration · In the Package Manager Console window, enter the following command: update-database · Use Server Explorer to inspect ...
Read more >
Entity Framework rollback and remove bad migration
Step 1: Restore to a previous migration · Step 2: Delete your migration from the project · Step 3: Add your new migration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found