© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
1 reply
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?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Better approach to grouping and ordering items?
C#CC# / help
2y ago
✅ Best approach for returning typed objects
C#CC# / help
11mo ago