Click here to Skip to main content
15,936,337 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm working on a small simple MVC 3 project. I have three layers basically.

Layer One - UI - Controllers, Views
Layer Two - Models
Layer Three - Business rules.

With Layer One - UI - I created a reference to Models and Business Rules.

With Business Rules, I created a series of Interfaces and I applied those interfaces to the Controllers in UI. I used Ninject Dependency Injection.

Simple so far - the basic idea works but this is where I'm stuck.

I created a WCF as a separate project. The WCF works just fine in preliminary tests but I came to the conclusion that I'm not doing a true separation of code in the controller.

In Layer One (UI) I added a web reference to the WCF and brought back a list of items in a simple Controller command like this:

Using (WCF w = new WCF()
..flood the view. Blah blah.

It works but I know my gut is telling me that this is the "wrong approach" when it comes to true coding of separation of layers.

I'm struggling with the idea of passing the reference to the WCF to Layer Two (business rules) via Injection. (Ninject Dependency Injection)

Basically, I could add a reference to the UI FROM the business layer but I already added a reference to the Business Layer from the UI - this would cause a "circular reference" which I suspect is a no-no.

I've been trying to find articles to tackle this method but alas...

Can anyone shed some light on this as to what articles I should review?


The WCF object should be hidden from the presentation layer, I think. It should be in the data layer, it's a way of getting access to data entity objects.

I've used Ninject, and discarded it. Your controllers can get passed entity objects instantiated by your own layer within MVC, and that's all I've never needed.
Share this answer
Thanks, Christian.

If we created a data layer and created a web reference in that layer, what do we do about the config.sys from the data layer regarding the WCF?

And from what I understand I can create a reference from the biz layer to the data layer?

Out of curiosity, why did you discard Ninject?

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900