Passing HttpFileCollectionBase to the Business Layer - Bad?
Posted
by Terry_Brown
on Stack Overflow
See other posts from Stack Overflow
or by Terry_Brown
Published on 2010-05-25T08:31:40Z
Indexed on
2010/05/25
8:41 UTC
Read the original article
Hit count: 256
hopefully there's an easy solution to this one.
I have my MVC2 project which allows uploads of files on certain forms. I'm trying to keep my controllers lean, and handle the processing within the business layer of this sort of thing.
That said, HttpFileCollectionBase is obviously in the System.Web assembly.
Ideally I want to call to something like:
UserService.SaveEvidenceFiles(MyUser user, HttpFileCollectionBase files);
or something similar and have my business layer handle the logic of how and where these things are saved.
But, it feels a little icky to have my models layer with a reference to System.Web in terms of separation of concerns etc.
So, we have (that I'm aware of) a few options:
- the web project handling this, and my controllers getting fatter
- mapping the HttpFileCollectionBase to something my business layer likes
- passing the collection through, and accepting that I reference System.Web from my business project
Would love some feedback here on best practice approaches to this sort of thing - even if not specifically within the context of the above.
© Stack Overflow or respective owner