I was working on a application for which i was using ASP.NET MVC. Then i came to know about n-tier architecture which i think gives more flexibility to the applications so i started converting my standard mvc project into n-tier. I also have role based views. Before asking this question i've read many online articles about N-Tier architecture but everyone has it's own kinda n-tier structure. I didn't find any example which shows standarized structure of N-Tier application. The MVC structure of my application was following :
Models :
- IBaseEntity
- IDeletableEntity
- IValidatableEntity
- File : IBaseEntity, IDeletableEntity, IvalidatableEntity
- User : IBaseEntitiy
Repositories :
- IRepo <T> where T : IBaseEntity
- IDeletableRepo <T> where T : IDeletableEntity
- IValidatableRepo <T> where T : IValidatableRepo
- Repo <T>: IRepo <T> where T : IBaseEntity
- DeletableRepo <T>: IDeletableRepo <T> where T : IDeletableEntity
- ValidatableRepo <T> : IValidatableRepo<T>where T : IValidatableRepo
- UnityOfWork //encapsulating all repos and providing acces to them
Services :
- IService <T>: where T : IBasEntity
- IValidatableService <T> where T : IValidatableEntity
- Service <T> : IService <T> : where T : IBasEntity
- ValidatableService <T>: IValidatableService <T> where T : IValidatableEntity
Controllers:
- FileController : Controller
- UserController : Controller
Views:
File :
- index.cshtml
- view.cshtml
Admin :
- view.cshtml //Admin has more option while viewing page)
User :
- Profile.cshtml
Admin :
- AllProfile.cshtml
For converting it into N-Tier, i started reading so many online articles but i'm still confused. However i implemented n-tier come up with following structure :
Project Solution
Project.BusinessObject
Models
Project.BusinessLogic
Services
Project.DataAccess
Repositories
Project.InversionOfControl
Autofac
Project.UserInterface
Controllers
ViewModels
Views
The flow of my n-tier applications is : Controllers -> Services -> Repoitory + AutoFac -> Models
Actually i wanted post an image but i could'nt beacuse of 10 reputation criteria of stackoverflow.
You can click here to see n-tier structure of my application
As it's my first experience with n-tier architecture i'm not sure if the application is well architectured or not. It'd be great help if someone can tell me about the points on which i was doing wrong or the points which need some kind of modification.
Some other questions if you could help me out : Business object is same as a model ? Business logics are methods for a business object ?
Aucun commentaire:
Enregistrer un commentaire