コード例 #1
0
ファイル: JasperRegistry.cs プロジェクト: fengweijp/jasper
        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;
            }
        }
コード例 #2
0
        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");
            }
        }
コード例 #3
0
ファイル: CallingAssembly.cs プロジェクト: kassadube/jasper
        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());
            }
        }
コード例 #4
0
ファイル: JasperRegistry.cs プロジェクト: hannanmumtaz/jasper
        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");
            }
        }