I have a main application with a class "Table" which implements the interface "ITable" from the dll "Lib":
Main Application:
using Lib; namespace One { public class Main { // Here the method "Work" from the plugin is called with first // parameter a string and second parameter a dictionary with "Table" // objects and then it shows here the fault message plugin.Work("My Input", tableDictionary) } public class Table : ITable { } }
Class library: "Lib"
namespace Two { public interface ITable { } }
Plugin-Project:
using Lib; namespace Three { public class Example { public string Work(string input, Dictionary<string, ITable> tableDict) { // Here i want to use table objects from the main application // Do something with the table objects } } }
A plugin for the main application is created in a second project "Plugin-Project" which uses the dll (because i want to use objects/class "table" of the main application in this second "plugin"-project). I follow here this plugin-approach:
Creating a simple plugin mechanism
But when i use the table-object in the plugin project, import it then to my main application and run the main application, i get the error which says that it "Cannot convert from "Table" to "ITable"" It is not an exception while runtime. It is just a fault shown in the fault list of VisualStudio.
The problem is i want to use an Table-object within the plugin just like the way i can use it in the main application. Therefore i use the interface. But then i just can use an ITable object while my main application uses Table objects?
Update: I edited the problem description a bit, hope it is better understandable now. (Deleted also the ITable object test in the plugin, it was just not right). In "Main" of the main application the plugin is imported etc. (works fine and is not shown in the code above) and then the method "Work" from the plugin is called. My simplified main concern is: How can i use the table objects of the main application within the plugin?