C
C#2y ago
KidKai25

❔ Idea for better approach for below problem?

Earlier: Local File System New Requirement: Integrate Azure storage system (Make configurable b/w File and Azure) My Idea: Create an Interface acting as an abstraction for client (Using factory method) Based on config either Azure or File will be used. Client code won't know. Client just ask for StorageObject and call Create/Download/Delete methods.
Interface IMyStorageObjectInterface
{
Create();
Download();
....
}
Interface IMyStorageObjectInterface
{
Create();
Download();
....
}
So,
IMyStorageObjectInterface storageObject = Storage.GetStorage(); //factory method
storageObject.Create(path); //Create would either upload on cloud or local
IMyStorageObjectInterface storageObject = Storage.GetStorage(); //factory method
storageObject.Create(path); //Create would either upload on cloud or local
Problem: I see a 3rd party library being used in some existing methods in the application 3rdPartyConvert&UploadMethod(string/stream filepath) I guess the above method will successfully upload file given right path(local file path). But how to do this with my Abstract methods(MyStorageInterface) for the client? Should I let the 3rdParty upload method do its work and then upload via my method(for file system, replace/ignore and for cloud upload it)? Maybe Create an overload of the method (Making such change in each of such methods)? <br> Any other perhaps, better ideas?
1 Reply
Accord
Accord2y ago
Looks like nothing has happened here. I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server