This imaginatively named example expands upon the
Echo Server CLR example and the basic structure is similar to that of the earlier example and you should go and read about that first and have a good understanding of how everything fits together. This document will only cover the differences between the
Echo Server CLR example and this example.
This example requires the "CLR Hosting" licensing option of The Server Framework and it requires libraries that only ship with that option (see
here for licensing options). You can always download the latest version of this example from
here; and although you will need the correct libraries to be able to build it you can look at the example code and see how it works and perhaps get ideas from it. A compiled, unicode release, build of this example is available on request if you require it for performance analysis of the framework.
This example expands on the previous example by providing assembly management and CLR event sinking functionality. Our CManagedHost class has been adjusted to Inherit from
JetByteTools::CLRHosting::IEventSinkCallback and register to receieve event notifications and also to respond positively to requests by the CLR for an implementation of
IHostAssemblyManager.
There's a new class CAssemblyManager which deals with providing assemblies to the CLR when asked. This simply loads assemblies from a specific directory into an in memory stream and then provides the CLR with an interface to the stream when requested. This is similar to how SQL server can store .Net code in its database and provide it to the CLR that it hosts. Our managed Application Domain Manager code has been adjusted to provide an implementation of the HostSecurityManager which understands the assemblies that we load and can provide the appropriate assembly evidence to allow the code to run.