Last active
March 7, 2020 20:40
-
-
Save rhysstubbs/58cc3ea5903e7e65e585fd0c3e7676d0 to your computer and use it in GitHub Desktop.
No Interface implementation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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