mardi 12 mars 2019

Repository, Unit of work, updating 2 tables without Entity Framework

I have been looking at upgrading our existing application. In a nutshell the current implementation is ASP.NET web forms and all the data access is in the code behind. We are using plain SQL for all the CRUD. I have been looking into separating the data access and business logic into a web api. I have implemented repository pattern, and that is working fine. My question is regarding a specific problem I encountered. I have a simple page Company Name URL Contact Name Contact Number Style (Drop down list) All the fields above (except style) are mapped to the DB table Company. The Style field lives in another table (System Configuration) My struggle is with the style field. Not just for this simple page, but the application has a number of pages with similar issues (fields from multiple tables). If my POCOs are 1:1 mapped to the DB (each class represents a table), should I stick he update function usingunit of work. So for example I can have an Update Method in my business layer that will do 2 updates

Update(companyInfo, systemConfig) And have that method wrap the calls in a Unit of work implementation? Am I going about this the right way? If so, does anyone have a unit of work example that doesn't use EF and uses good old sql commands?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire