Alternative DLLs as objects (dynamically replaceable objects)

I have an application that uses many different .NET managed DLLs as objects (each DLL implements a common interface). Each DLL also has a version number in the file name.

Suppose I create a Shape ~ 01.dll object. The application will use this DLL, but cannot be replaced while the application is running. So if I want to "update" the form dll, I need to create "Shape ~ 02.dll" and the application has to dynamically search and load the newest dll every time the form is created and / or the user has to restart the expression. Even worse, each dll depends on the main .exe, so it needs to be rebuilt with the main .exe.

Is there an easier way to have dynamically "swappable" objects?

0


source to share


3 answers


Well, this is not the best solution (still thinking about it), but you can unload DLLs that will allow them to be replaced. This can be a quick workaround until you come up with a better idea.



0


source


You do not specify which language / platform you are trying to execute, so I am responsible for the .NET Framework.

If you want to do this take a look at shadow assemblies, this is the method that ASP.NET uses to update the site even though it uses.



For an easier way, take a look at the new System.Addin namespace , this uses shadow assemblies under the hood and should do what you want.

0


source


Instead of polling when creating an object, why not just request notification from the system when the file system changes?

The System.IO.FileSystemWatcher class in .NET.

For native code there are multiple ways to view the folder, but IANAND (I'm not a developer;).

Even though you've said these things, you probably want to rethink the reason you need to change your objects frequently, because it will probably take a lot of work to get it to work.

Have you used a dynamic tag, so maybe you should try a dynamic language? :)

-1


source







All Articles