> 1. Is the plan to use WCF to function as the service layer here? I
> talked with a fellow developer where I work and he indicated that
> after attending a lecture by Juval that this was the direction MS was
> going in.
Well, in my opinion, WCF would be a way of using the services provided by
the model. I only see WCF as thin wrapper and responsible for preparing the
necessary infrastructure needed for my services (ex.: creating the
necessary dependencies and injecting them into the services before they
start doing their work). I guess that you could always put this into your
WCF services, but I do prefer having them separated.
>
> 2. If not, is (or can) the controller's project be considered a
> proper place for such logic? I'd agree with Rob in his post that this
> blurs the true responsibility of controllers to simply manage
> application flow.
As always, it could be. From a theoretical point of view, you should
probably separate them into two different classes: services could be
responsible for coordinating the use of domain objects and controllers would
be consumers of those services. However, if your web app is the only
consumer of your domain, then you could probably merge those
responsibilities into a single class: the controller (personally, I'd always
go with a service layer, but...)
>
> 3. If then the controller project isn't designed to stand in lieu of
> a services layer ... it would seem like this is sorely needed to be
> included in the framework.
Not sure if that would really be necessary. Even if that case, I'm not sure
that you're gaining much by doing putting the controller into a separate
project...are you going to reuse that controller across different web
projects?
>
>
> With all the excitement I've seen previous discussions on a Services
> layer generate ... I'm looking forward to the next 400-500 responses
> to this post. :)
You bet! I've already done my part and sent the 1st message :)
Luis
---
Luis Abreu
I'm not sure on what you mean by validation...If this is something necessary
for the integrity of the domain then it should be performed in the domain
and not in the controller.
---
Luis Abreu
I really don't see advantages on keeping the mvc project in a closet, but
probably that's because I don't like closets :)
---
Luis Abreu
I agree with what you say about using several assemblies for separating
layers/concerns. However, the 2 assembly thingy will only work for simple
cases where your domain is directly consumed by the ASP.NET project.
---
Luis Abreu
Agree but only with the option 3 :)
I mean, I agree with the current separation of assemblies on the framework
because one of your objectives is to share the domain model with the final
consumers (this probably isn't really visible on the MVC sample, but if you
had a win forms app with services running you'd see this reuse more easily).
Note: I'm not saying that I agree/like this approach, but it has been the
approach that has been followed by the team since the beginning, right?
In this scenario, yes, repositories should be on a different assembly
because you don't really won't to let your clients (recall the win forms app
example I've pointed earlier) to use them directly (they will probably be
used (directly or indirectly) only by the WCF service that feeds the win
forms apps.
Now, let's say that you do not want to reuse domain objects and that you
want to have them neatly encapsulated on the server side (probably by using
WCF services). In this case, will the repository/core domain separation make
sense? Do I gain anything from it? Well, probably not (unless you have a
really bad team and that's the only way you can make them not understand IoC
- now that I mention this, I do recall that this is really what happens in
where I'm working now :( ).
Too many assemblies can be also a problem, especially when the number starts
growing exponentially...
---
Luis Abreu