I have custom assembly that is loaded on runtime.
at this point i have code that loads dll and can create new instance of object andexecute method.
How can i verify that the class implements all functions i have defined in interface.
(i am trying to create plug in system with different action that can be switched on runtime, to provide different behaviour).
where my code would be like this is main program:
public Interface IArticleManager{
void SetMenuId(int MenuId);
void SetMenu(string name);
void SetContent(string content);
bool Save();
}
my class libraries (disconnected you can see it from solution)
public class XmlArticle{
public void SetMenuId(int MenuId){
//some implementation
}
public void SetMenu(string name){
//some implementation
}
public void SetContent(string content){
//some implementation
}
public bool Save(){
}
}
public class SqlArticle{
public void SetMenuId(int MenuId){
//some implementation
}
public void SetMenu(string name){
//some implementation
}
public void SetContent(string content){
//some implementation
}
public bool Save(){
}
}
It seems like what you need to do is move the interface into a separate assembly, which only contains interfaces which is accessible to both the ‘main program’ and the dynamically loaded DLLs.
So, in order to create a dynamically loaded DLL and expect it to work within your infrastructure, the author will first need to reference the interface assembly and then implement the provided interface.