asp.net mvc - How to use Repository and Unit of Work Patterns with ADO.NET? -
i building asp.net mvc 5 application.
i read repository , unit of work (uow) patterns here.
these examples use entity framework adds high-level of abstraction itself.
i using ado.net , not ef. want know:
- whether repository , uow patterns makes sense ado.net?
- how repositories , uow ado.net? samples?
- can add separate class library repository or make part of dal?
i've written blog post teaches on how write driver independent code , how implement uow/repository pattern plain ado.net.
it's bit long include in answer, idbtransaction
represent unit of work (or contained in one) , every repository take transaction or uow in it's constructor.
to create command using idbtransaction
using (var cmd = transaction.connection.createcommand()) { cmd.transaction = transaction; //do crud operation here. }
Comments
Post a Comment