public static IEndpointFacade CreateAndConfigure <T>(EndpointDefinition endpointDefinition, Action <T> config) where T : IEndpointConfiguration { var version = GetEndpointVersion <T>(); var startupDirectory = new DirectoryInfo(Conventions.AssemblyDirectoryResolver(version)); var appDomain = AppDomain.CreateDomain( startupDirectory.Name, null, new AppDomainSetup { ApplicationBase = startupDirectory.FullName, ConfigurationFile = Path.Combine(startupDirectory.FullName, $"Facade_{version}.dll.config") }); var assemblyPath = Conventions.AssemblyPathResolver(version); var typeName = Conventions.EndpointFacadeConfiguratorTypeNameResolver(version); var facade = (IEndpointFacade)appDomain.CreateInstanceFromAndUnwrap(assemblyPath, typeName); var configurator = (T)facade.Bootstrap(endpointDefinition); config(configurator); configurator.Start(); return(new DisposingEndpointFacade(facade, appDomain)); }
public IEndpointConfiguration Bootstrap(EndpointDefinition endpointDefinition) { throw new NotSupportedException("Bootstrapping is not supported at this stage."); }