Skip to main content

Posts

Showing posts from November, 2016

#AT Repository and Unit of Work Pattern - 2

Creating a sample application I am going to create to projects in a solution. BusinessTyre and WCF restful/web api   DTO (data transfer object) 1. BusinessTyre  is going to have below folders, DataBaseLayer for edmx UnitOfWork for unit of work and generic repository Service 2. WCF restful for proving the service to any presentation project. WCF restful project. 3. DTO will have the models that are user for data transfer.(not DB models. common to service and business project) let we start coding... create DB and tables CREATE TABLE [dbo].[LoginUser]( [Id] [bigint] IDENTITY(1,1) NOT NULL, [Name] [varchar](30) NULL, [Password] [varchar](30) NULL, [Status] [char](1) NULL DEFAULT ('A'), PRIMARY KEY CLUSTERED ( [Id] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] ------------------------------ CREATE TABLE [dbo].[LogRegiste...

#AT Repository and Unit of Work Pattern - 1

Repository and Unit of Work Pattern Repository and Unit of work pattern provides a clean way to access data using ORMs, keep all the data access logic in one central location and at the same time maintain the test-ability of the application. Improve the code's maintainability and readability by separating business logic from data or service access logic. To maximize the amount of code that can be tested with automation and to isolate the data. What is the use of Unit of Work design pattern? Unit of Work design pattern does two important things: first it maintains in-memory updates and second it sends these in-memory updates as one transaction to the database. So to achieve the above goals it goes through two steps: It maintains lists of business objects in-memory which have been changed (inserted, updated, or deleted) during a transaction. Once the transaction is completed, all these updates are sent as one big unit of work to be persisted physically in a...