N-Tier Architecture Template
This project provides a Visual Studio Extension (VSIX) containing 4 Item Templates required for projects working with N-Tier Architecture. This extension includes templates for Entity
, Dto
, Repository
, and ServiceHelper
that you can use in your projects.
Contents
Setup
- Download the VSIX File: Download the latest version from the Visual Studio Marketplace page.
- Installation: Double-click the downloaded
.vsix
file and install it to Visual Studio.
- Restart Visual Studio: Restart Visual Studio to apply the changes.
Usage
- Add New Item:
- Right-click on a project folder in Solution Explorer.
- Select
Add
> New Item
.
- In the window that opens, select a template from
C# Items
> ME Templates
(Entity
, Dto
, Repository
, ServiceHelper
).
- Enter the name of the file and click the
Add
button.
Templates
Entity
The Entity
template typically represents database tables and defines the data model.
Example Usage:
public class Product : BaseDto {
}
Dto
The Dto (Data Transfer Object)
template is typically used to create objects for data transfer.
Example Usage:
public class ProductDto : BaseDto {
}
Repository
The Repository
template provides cleaner architecture and data access.
Example Usage:
public class ProductRepository : BaseRepository<Product> {
public ProductRepository() { }
}
ServiceHelper
The ServiceHelper
template is used to create helper classes used in the service layer. It prevents code duplication and handles error checking across services.
Example Usage:
public class ProductService : BaseService<ProductRepository, ProductDto, Product> {
public ProductService() { }
}