Simple Injector in Onion Layer Architecture

I’m trying to find a good resource, advice, etc in a project I’ve taken on for myself at work.

Background

When I started here we had a application that was part MVC part Webform (separate projects on solution) that was tightly coupled to it’s DAL with business code all over the place.

I refactored the entire solution into the onion layer architecture almost two years ago using ninject. killed of it’s SOAP services in favor of WebAPI and moved the vast majority of the webforms into MVC overtime. (still some left in webforms, but their days are numbered)

Overall this has been a major success in regards to maintainability, stability, and getting our business logic where it belongs. Lately though performance has been a growing issue. We’ve establish multiple causes, but we were surprised at how badly ninject was impacting our performance, after some research we found ninject was infact one of the worst DI frameworks from a performance stand point. With this in mind we’re moving to simple injector as it impressed us.

The problem

We don’t just rewrite our work, we gradually move it where able. We all know we can’t realistic blend ninject with simple and not expect utter chaos. With that in mind we cleaned up our code to make sure it all would work with both ninject and simple and we’re to that final step of actually wiring the whole thing up…

Except every guide, tutorial, and example I’ve found has the actual UI project (MVC) reference both the interface and the project I’ll inject my classes from…

Example:

container.Register<ILoggingService, LoggingService>();

With Onion Architecture we strived to make sure our front end had no direct references to the supporting code. This was handled by having a project separate from my MVC project to handle injection thereby allowing me to never have a reference between my UI and my backend code. (Thus preventing you from accidentally bypassing your interface and DI)

The above would require me to directly reference the backend code and in my opinion fundamentally defeat what we’ve strived to do. Perhaps my heads not all together from being tired + mentally on holiday already, but I’m having a heck of a time trying to figure out how to accomplish what we had under ninject in simple injector (I’m sure it’s stupid easy, but I’ve been beating my head on this for hours so any help would go a long way)

3

Usually, there is some kind of “Application” or “Launcher” project, which references every assembly the application needs to run. Only responsibility of this project is to wire up the dependencies and start up the application. It has no UI and no behavior. But I’m not sure how this would handle in MVC application.

3

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật