0

How can i save a DLL in sql table BINARY(n), and then retrieve it save on disk and reference to it, so the main application can use it? (c#)

jaleel
  • 373
  • 8
  • 13

2 Answers2

1

After you return the DLL from the database and save the file, you can then use the AppDomian class to load your DLL. Please refer to AppDomainProject for sample code.

Load the DLL call a method in the DLL and then unload the DLL

Nequeo.Reflection.AppDomianHost host = new Nequeo.Reflection.AppDomianHost(@"D:\Development\Version2015\Test\LoadUnload\ConsoleLoadUnload\bin\Debug");
int ret = host.Instance.ExecuteMethod<int>("ConsoleLoadUnload", "ConsoleLoadUnload.Test", "EntryPoint", new object[] { (int)6, (int)6 });
host.Unload();

textBox1.Text = ret.ToString();
D.Zadravec
  • 647
  • 3
  • 7
0

Reference this answer https://stackoverflow.com/a/2579467/1865718 for save file into database and get file from database.

Then you can use the dll through System.Reflection.Assembly.Load(bytes); or System.Reflection.Assembly.LoadFrom('File path');.

Community
  • 1
  • 1
Anders Chen
  • 83
  • 3
  • 7