예제 #1
0
        private static string GetXmlCommentsPath()
        {
            var assembly = TypeLocator.GetEntryPointAssembly();
            var xmlFile  = $@"{AppDomain.CurrentDomain.BaseDirectory}\{assembly.GetName().Name}.xml";

            return(File.Exists(xmlFile) ? xmlFile : null);
        }
        public void Run(IApplication appInstance)
        {
            appInstance.ReportHealthStateAction = (property, state, description) => { };
            appInstance.ReportRecurrentHealthStateAction = (property, state, timeToLive, description) => { };
            appInstance.GetCodePackageVersionFunction =
                () => TypeLocator.GetEntryPointAssembly().GetName().Version.ToString();
            appInstance.GetDataPackageVersionFunction = packageName => $"{packageName}.{DateTime.Now.Ticks}";

            Application.Instance = appInstance;
        }
예제 #3
0
        private void RegisterServiceBuses(ContainerBuilder builder)
        {
            if (initializationParameters.ServiceBusParameters.Any())
            {
                var module = new ServiceBusAutofacModule(initializationParameters.ServiceBusParameters);
                builder.RegisterModule(module);
                ServiceBusInterceptorsProvider.Add(new ServiceBusInterceptor());
            }

            if (initializationParameters.ConsumerRegistrator != null)
            {
                var entryAssembly = TypeLocator.GetEntryPointAssembly();
                var consumers     = entryAssembly.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(IConsumer)));
                var module        = new ConsumerAutofacModule(consumers, initializationParameters.ConsumerRegistrator);
                builder.RegisterModule(module);
            }
        }
예제 #4
0
        private void RegisterServiceBuses(IServiceCollection services)
        {
            if (StartupParameters.BusInitiators.Any())
            {
                var module = new ServiceBusModule(StartupParameters.BusInitiators.Select(x =>
                                                                                         new Tuple <Type, IServiceBusInitiator>(x.ConsumerBusType, x.Initiator)));
                services.RegisterModule(module);
                ServiceBusInterceptorsProvider.Add(new ServiceBusInterceptor());
            }

            var registrator = StartupParameters.ConsumerRegistrator;

            if (registrator != null)
            {
                var entryAssembly = TypeLocator.GetEntryPointAssembly();
                var consumers     = entryAssembly.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(IConsumer)));
                var module        = new ConsumerModule(consumers, registrator);
                services.RegisterModule(module);
            }
        }
예제 #5
0
#pragma warning restore SA1118 // Parameter must not span multiple lines
        public Version GetAssemblyVersion()
        {
            var assembly = TypeLocator.GetEntryPointAssembly();

            return(assembly.GetName().Version);
        }
예제 #6
0
 private static string GetVersion()
 {
     return(TypeLocator.GetEntryPointAssembly().GetName().Version.ToString());
 }
예제 #7
0
        public ServiceNameEnricher()
        {
            var assembly = TypeLocator.GetEntryPointAssembly();

            serviceType = assembly.GetTypes().FirstOrDefault(t => t.IsSubclassOf(typeof(ServiceShell)));
        }