public void Preload(string[] parameters) { var repository = new MyRepositoryClass(); HttpRuntime.Cache.Insert( "CollectionName", repository.GetCollection(), Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); }
static void Main(string[] args) { //var configValue = XDocument.Parse("<config><hardware>type1</hardware></config>").Document.Descendants("hardware").First().Value; var configValue = XDocument.Load("MyXmlConfig.xml").Document.Descendants("hardware").First().Value; if (configValue == "type1") { System.Reflection.Assembly.LoadFile(@"C:\TEMP\MyAssembly_Type1.dll"); } else if (configValue == "type2") { System.Reflection.Assembly.LoadFile(@"C:\TEMP\MyAssembly_Type2.dll"); } MyRepositoryClass.Initialize(); }
static void Main(string[] args) { AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve; MyRepositoryClass.Initialize(); }