views:

131

answers:

3

So, I am working on this web based app following the Repository model, a wannabe DDD dork, using StructureMap.... blah, blah, blah...

One aspect of the application allows users to upload and manage files.

Where, what layer, should be responsible for managing the saving/ deleting of these user files?

The Business Layer, or the Data Access Layer...?

It, for whatever reason, doesn't seem a straight forward answer...

Historically, I just slapped it in the GUI, but striving to be more programmaticall correct and rethinking what should handle these service. Maybe I just answered my own question...

RA

A: 

I would put it in the business layer, though if it were me, I'd end up making calls to the DAL with regards to the files each user has uploaded. I'd keep track in the database of the file names and locations for each file a user uploads.

Nick DeVore
That is precisely how I have it now. But something smells funky.. maybe just me not taking a shower today...
A: 

I put mine in the DAL since we considered the files data in which to update or query, just through a different "protocol" that being System.IO.

More specifically, I made a FileManager class that handled all the basics and even had a couple of constants in place so it was easy enough to change path locations for development and production environments, since they were drastically different.

Dillie-O
Thus proving there's no right answer, just the one that best fits for your application!
Nick DeVore
True true, I guess it depends on what you want to define the file interaction as, a business related function or a data related function.
Dillie-O
A: 

Dillie-O - Furthermore, if the application ever switched to storing files from the IO to the DB, the DAL is a more logical place. Some flexibility...