ADO.NET Native to EF6 Migration
A story written with experience of migrating .Net codebase from SQL Server to Multiple Databases support.
galaxy
Regtech.jpeg
ADO.NET Native to EF6 MigrationADO.NET Native to EF6 Migration

Why Migration?

For .Net based projects, SQL Server may not the only choice when it comes to enterprise. Considering Microsoft licensing change from processor based to core based in 2012, its not the pocket friendly option any more and demand for other databases has increased.

That forces many of the enterprise applications to support various other databases which offer great security features and licensing options.

Due to increased demand, one has to migrate to Object-Relational Mapping(ORM) framework or equivalent implementation based on needs.

ORM or Native Drivers:

Native Driver based implementation expects dynamic switching/multiple code bases. So, new database support may require changes to code base.

We have evaluated two ORM frameworks nHibernate and Entity Framework (EF6). We happened to choose EF6 considering better long term support for enterprise.

In my case, I have chosen EF6 with Code First approach. Code First approach enables us avoid database specific configuration files.

Performance Results (Native SQL Provider vs EF6 ORM):

  • Performance tests are run on basic identical servers.

  • ORM initialization is performed before running performance test.

25k iterations Test Result.png

50k iterations Test Result.png

Select with Pagination Test Result.png

Advantages:

  • EF Providers from respective DB owners is a huge advantage

  • Compiled queries with LINQ (Less run-time surprises)

  • No manual SQL statements

  • Automatic Query generation, which is SQL Injection Safe

Disadvantages:

  • Performance cost is upto 2X of ADO.NET without ORM. This can be covered with few optimizations, but it does not match with native performance.

  • No control over generation of query. This is acceptable, as long as support from providers is good. So far, Oracle, PostgreSQL and SQL Server seems very active and stable with latest releases.

Even though performance results are not encouraging, its features for multiple databases and fact that we can stick to one code base encouraged us to choose EF.

Things to be taken care during migration:

  1. Unlike SQL server, most other databases are case-sensitive for table names and column names. In order to overcome these issues, we choose to create tables and columns by forcing case sensitivity same as Model.

  2. In case your application uses Forms Authentication or similar which demands native providers. This part needs to be rewritten with a custom provider.

  3. Free Style SQL queries has to be converted to LINQ. No more string based queries

  4. Say No to most of the Stored procedures, as databases like PostgreSQL does not support them. By adding certain blocks, will force your app to stick to fewer databases.

  5. For .Net applications, its common to use SSRS based Reports(Written in RDL). If that is the case, one has to convert all RDL based reports to RDLC reports.

Summary:

Essentially, EF6 has performance overhead compared to native drivers. But, it provides a great way to code using LINQ and achieve database portability. Learning curve for EF6 is minimal for a person who is familiar with LINQ.

Happy Coding!

Other Articles you may like:

Happy client
2023-02-07
The Benefits of Regulatory Reporting for Banks Regulatory reporting is a critical part of banking, as it helps to ensure that banks are following the rules and regulations set out by governments and other regulatory bodies. It helps to keep banking activities safe and transparent, which in turn can help banks to better serve their customers. In this blog post, we will look at some of the benefits of regulatory reporting for banks. Read more
galaxy
Reach out to know more
What People say?
In 2014, Doha Bank decided to move to a structured ALM solution and decided to implement Surya BALM. In addition, it was decided to procure a FTP system to meet the profitability measurement requirements. These systems were implemented successfully within in a short span of time in Qatar, Kuwait & UAE. A consolidator that aggregates ALM positions at the head office has also been implemented.
Surya has helped to significantly reduce the end of day processing time to under 45 minutes. Besides the central bank reporting, BALM has helped the bank produce Basel III liquidity reports. We are happy to have partnered with Surya, support from them has been reassuring.
Gaurav Dhingra
Head of Financial Risk
I have been working with Surya Software for 15 years. There were several projects for various companies as different as Street lighting control systems or Watch Retail. The capacity of Surya to understand properly the issues related to specific businesses, to answer quickly to complex proposals, and to deliver on time appropriate developments, have given satisfactory and confidence to the end-users vis-à-vis Surya.
Henri MABILLE
CIO
In 2014, Doha Bank decided to move to a structured ALM solution and decided to implement Surya BALM. In addition, it was decided to procure a FTP system to meet the profitability measurement requirements. These systems were implemented successfully within in a short span of time in Qatar, Kuwait & UAE. A consolidator that aggregates ALM positions at the head office has also been implemented.
Surya has helped to significantly reduce the end of day processing time to under 45 minutes. Besides the central bank reporting, BALM has helped the bank produce Basel III liquidity reports. We are happy to have partnered with Surya, support from them has been reassuring.
Gaurav Dhingra
Head of Financial Risk
I have been working with Surya Software for 15 years. There were several projects for various companies as different as Street lighting control systems or Watch Retail. The capacity of Surya to understand properly the issues related to specific businesses, to answer quickly to complex proposals, and to deliver on time appropriate developments, have given satisfactory and confidence to the end-users vis-à-vis Surya.
Henri MABILLE
CIO
CLIENTS SERVED
First-Capital-Bank-thumb-1280x720-removebg-preview.pngMicrosoftTeams-image__1_-removebg-preview (1).pngunnamed__1_-removebg-preview.pngMicrosoftTeams-image__2_-removebg-preview.pngdownload (1).pngdownload (2).pngSIDBI_LOGO.pngNKGSB Bank.pngdownload-removebg-preview (2).pngShivalik_Bank-removebg-preview.pngaditya-birla-capital-limited-removebg-preview.pngAxis_Bank_logo.svgbelstar-investment-and-finance-private-limited_owler_20210830_161832_original.pngCDH_Investment_Bank.jpgimages.pngDB-LOGO-300.pngjanalogo.pngthumbnail_Group_22804_5b2c73eb43.pngIndian_Bank-removebg-preview.pngdownload__1_-removebg-preview.pngDCB_Bank-removebg-preview.png2560px-RBL_Bank_SVG_Logo.svg-removebg-preview.pngSBM_Bank-removebg-preview.pngKarur_Vysya_Bank.svgNPCI-Logo-removebg-preview.png
© Copyright 2023 Surya Software Systems PVT. LTD. All Rights Reserved