Hi folks,
I've got an interface which i've used StructureMap
to Dependency Inject.
public interface IFileStorageService
{
void SaveFile(string fileName, byte[] data);
}
The interface doesn't care WHERE the data is saved. Be it to the memory, a file, a network resource, a satellite in space....
So, i've got two classes that implement this interface; a test class
and a network file storage class
:-
public class TestFileStorageService : IFileStorageService
{ ... etc ...}
public class NetworkFileStorageService : IFileStorageService
{
public string NetworkUnc { get; set; }
public void SaveFile(...);
}
Notice how my NetworkFileStorageService
has a property? That class requires that value in it's implementation of the SaveFile method.
Well, i'm not sure how to define that property.
I thought i could hard code it where i define my dependency (eg. in my bootstrapper method -> ForRequestedType<IFileStorageService>
... etc) but the kicker is .. the business logic DEFINES the location. It's not static.
Finally, because i use interfaces in my logic, this property is not available.
Can anyone help?
If you can, image you want to save two files
- Name: Test1.bin; location: \server1\folder1
- Name: Test2.bin; location: \server1\folder2
cheers!