I am trying to create content management library for sharepoint and in future we could deal with any CMS like google drive etc.
Right now I am using sharepoint as Document Management system hence i am trying to write an abtraction layer in such a way that no matter what cms we use our client code should not be changed.It should always work with that abstraction.
So this is the structure which i have in mind :
I will have 1 ContentManagement.Library.Common
which will have abstraction like this :
public interface IContentRepositoryConnection : IDisposable
{
string Username { get; set; }
string Password { get; set; }
string ClientId { get; set; }
string ClientSecret { get; set; }
void Create(); // handshake with sharepoint/google drive server using username/password or ClientId/Secret
}
public abstract class ContentRepositoryConnection : IContentRepositoryConnection,IDisposable
{
public abstract string Username { get; set; }
public abstract string Password { get; set; }
public abstract string ClientId { get; set; }
public abstract string ClientSecret { get; set; }
public void Create()
{
throw new NotImplementedException();
}
public void Dispose()
{
throw new NotImplementedException();
}
}
Here is my seperate Sharepoint.library
which will deal with sharepoint specific apis and sharepoint server :
public class SharepointConnection : ContentRepositoryConnection
{
//Where should i place SiteUrl Property which deal with sharepoint?
//override relevant methods
}
Client (Console/Winform) : Will have reference of only ContentManagement.Library.Common
Client will always work with ContentRepositoryConnection
class so that in future if client can easily swap between sharepoint/google drive.
Now in order to create ClientContext(just like EF Dbcontext), there are couple of parameters which sharepoints needs like SiteUrl,Username,password which might differ from Google Drive so how do i create this abstraction?
Now suppose tomorrow if i change my abstraction layer in a way that it can work with google drive and not impacting sharepoint client is possible?
This is how Client Context(Which is everything is Sharepoint) is created :
var ctx = new ClientContext(siteUrl,username,password);
I know every ORM like EF,dapper always works with abstraction(DbConnection class) instead of Concrete class(SqlConnection,OracleConnection etc..) so I am also trying to achieve same sort of abstraction in a nutshell.
Can anybody please guide me with some design changes or structure or can suggest some changes in above structure if there is any?
Aucun commentaire:
Enregistrer un commentaire