public static void Configure(IContainer container, string assemblyPrefix = "BW") { var builder = new ContainerBuilder(); var assemblies = AssemblyLoad.GetAllProjectAssemblies(assemblyPrefix); builder.RegisterAssemblyModules(assemblies); builder.Update(container); }
/// <summary> /// Performs the actual loading of the assembly, updates data structures, and /// fires the <see cref="AssemblyLoad"/> event. /// </summary> private static Assembly LoadCore(string fullPath) { byte[] bytes = File.ReadAllBytes(fullPath); Assembly assembly = Assembly.Load(bytes); string assemblyName = assembly.FullName; s_assembliesFromFiles[fullPath] = assembly; s_filesFromAssemblyNames[assemblyName] = fullPath; s_assembliesFromNames[assemblyName] = assembly; AssemblyLoad?.Invoke(null, new AssemblyLoadEventArgs(fullPath, assembly)); return(assembly); }
protected override void Load(ContainerBuilder builder) { if (Config.IocAssembly.IsNotNullOrEmpty()) { Config.IocAssembly.Split(',').Each(t => builder .RegisterAssemblyTypes(AssemblyLoad.GetAllProjectAssemblies(t.ToString().Trim())) .PropertiesAutowired()); } if (Config.Controllers.IsNotNullOrEmpty()) { var mvc = AssemblyLoad.GetAllProjectAssemblies(Config.Controllers); if (mvc != null) { builder.RegisterControllers(mvc).PropertiesAutowired(); } } builder.RegisterFilterProvider(); }
// This method is called by the VM. private static void OnAssemblyLoad(RuntimeAssembly assembly) { AssemblyLoad?.Invoke(AppDomain.CurrentDomain, new AssemblyLoadEventArgs(assembly)); }
// This method is called by the VM. private static void OnAssemblyLoad(RuntimeAssembly assembly) { AssemblyLoad?.Invoke(null /* AppDomain */, new AssemblyLoadEventArgs(assembly)); }
// This method is called by the VM. private void OnAssemblyLoadEvent(RuntimeAssembly LoadedAssembly) { AssemblyLoad?.Invoke(this, new AssemblyLoadEventArgs(LoadedAssembly)); }
public static void ConfigureApplication(IContainer container) { AssemblyLoad.ForceLoadAllReferencedAssemblies(); AutofacConfig.Configure(container); }