Skip to content

Instantly share code, notes, and snippets.

@rhysstubbs
Last active March 7, 2020 20:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rhysstubbs/58cc3ea5903e7e65e585fd0c3e7676d0 to your computer and use it in GitHub Desktop.
Save rhysstubbs/58cc3ea5903e7e65e585fd0c3e7676d0 to your computer and use it in GitHub Desktop.
No Interface implementation
namespace Example.Storage
{
public class ExampleWithoutInterface
{
protected readonly IHostEnvironment Env;
public ExampleWithoutInterface(IHostEnvironment env)
{
this.Env = env;
}
public void SaveFile(IFormFile file)
{
if (env.IsDevelopment())
{
// Save the file locally
var localUploader = new LocalFileUploader();
localUploader.SaveFileLocally(file);
}
else
{
// Save the file via AWS
var awsUploader = new AWSUploader();
awsUploader.SaveToAWS(file);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment