views:

51

answers:

1

I have this scenario:

i have a assembly with my business object types and this assembly is loaded with reflection at runtime(Assembly.LoadFile) in WCF with KnownTypesProvider but this assembly maybe can change (some developer add a new method or new property o even change some functionality maybe bugfix) but using Assembly.LoadFile the assembly file is locked and i can't replace this assembly.

Exists a framework for type caching? using assembly ver. or assembly mod date? or even exists a way to load without lock assembly?

THX!!!!!!!!

+2  A: 

You can not exchange an assembly while the application is running. Even if you use ReflectionOnlyLoad it gets locked. I think you can't neither unload the assembly. You need to restart your application.

If it is important for you to automatically reload assemblies, you can try to put everything depending on this assembly into a AppDomain, and restart the app domain.

If you are using GAC, you could install another version of the assembly, redirect it and restart the application.

Stefan Steinegger