In my ASP.NET MVC web application, I have:
Domain Model, created by LINQ to SQL
Repositories such as
UserRepository
and OrderRepository
IQueryable Fluents as IQueryable Extension Methods such as
public IQueryable<Order> GetNewOrders(this IQueryable<Order>)
Services such as
UserService
and OrderService
Utility Classes and Extension Methods such as
CryptoUtility
(doing Hashing etc.) and String etc. extensions
ViewModels which are special for each MVC View
The ASP.NET MVC project itself (Controllers, Views)
I'm looking for the best project structure/organization for my case, especially separating into different assemblies and how dependencies should look like between these layers. Web resources unfortunately don't go into good detail about this.
One hint: Currently Repository, Services, IQueryable Fluents etc. work directly against domain model implementation, I don't have an interface definition for them. I considered it unnecessary but maybe this is needed for loose coupling? My Services have an interface (e.g. IOrderService), and my repositories implement IRepository<T>.
Appreciate your input on organizing this in a concise manner, and especially what layer should depend on what & assembly organization. Thank you!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…