public JasperRegistry() { Features.Include <ConnegDiscoveryFeature>(); _bus = Features.For <ServiceBusFeature>(); Http = Features.For <AspNetCoreFeature>(); Publish = new PublishingExpression(_bus); _applicationServices = new ServiceRegistry(); ExtensionServices = new ExtensionServiceRegistry(); Services = _applicationServices; ApplicationAssembly = CallingAssembly.DetermineApplicationAssembly(this); deriveServiceName(); var name = ApplicationAssembly?.GetName().Name ?? "JasperApplication"; Generation = new GenerationRules($"{name}.Generated"); Logging = new Logging(this); Settings = new JasperSettings(this); Settings.Replace(_bus.Settings); if (JasperEnvironment.Name.IsNotEmpty()) { EnvironmentName = JasperEnvironment.Name; } }
private void establishApplicationAssembly(string assemblyName) { if (assemblyName.IsNotEmpty()) { ApplicationAssembly = Assembly.Load(assemblyName); } else if ((GetType() == typeof(JasperRegistry) || GetType() == typeof(JasperOptionsBuilder))) { if (_rememberedCallingAssembly == null) { _rememberedCallingAssembly = CallingAssembly.DetermineApplicationAssembly(this); } ApplicationAssembly = _rememberedCallingAssembly; } else { ApplicationAssembly = CallingAssembly.DetermineApplicationAssembly(this); } if (ApplicationAssembly == null) { throw new InvalidOperationException("Unable to determine an application assembly"); } }
public static Assembly DetermineApplicationAssembly(JasperRegistry registry) { var assembly = registry.GetType().GetAssembly(); var isFeature = assembly.GetCustomAttribute <JasperFeatureAttribute>() != null; if (!Equals(assembly, typeof(JasperRegistry).GetAssembly()) && !isFeature) { return(assembly); } else { return(CallingAssembly.Find()); } }
private void establishApplicationAssembly() { if (GetType() == typeof(JasperRegistry)) { if (_rememberedCallingAssembly == null) { _rememberedCallingAssembly = CallingAssembly.DetermineApplicationAssembly(this); } ApplicationAssembly = _rememberedCallingAssembly; } else { ApplicationAssembly = CallingAssembly.DetermineApplicationAssembly(this); } if (ApplicationAssembly == null) { throw new InvalidOperationException("Unable to determine an application assembly"); } }