A Unified Design and Implementation for Creating, Reading, Updating and Deleting Operations Based on ADO.NET Entity Framework

The code for creating, reading, updating and deleting (CRUD) operations based on ADO.Net Entity Framework (EF) was similar, mixed with business logic (BL) and distracted developers’ concentration from BL. This paper proposed a unified design and implementation (UDI) for CRUD based on EF to avoid above problems. Through Generics, Reflection and Lambda expression tree, the repetitive code was reduced. It was found that internal CRUD procedure was definite and external entity’s BL was changeable. So Inversion of Control (IoC) pattern which enabled the BL separating with persisting code was applied. The paper took the MVCMusicStore as an example to apply UDI. The modified example ran as well as the original one. Then the applying results were discussed. Finally, it was concluded that UDI for CRUD based on EF was useful to avoid repetitive code, reduce the mixture of BL code with CRUD and help the developers concentrate on BL.