Пример #1
0
        /// <summary>
        /// Load your modules or register your services here!
        /// </summary>
        /// <param name="kernel">The kernel.</param>
        private static void RegisterServices(IKernel kernel)
        {
            //try
            //{
            var mockupService           = typeof(IFhirMockupService);
            var fhirService             = typeof(IFhirService);
            var fhirStructureDefinition = typeof(AbstractStructureDefinitionService);
            //var typesToEnable = new List<TypeInitializer> {mockupService, fhirService, fhirStructureDefinition};
            var serviceTypes = new List <TypeInitializer>
            {
                new TypeInitializer(false, mockupService, nameof(IFhirMockupService)),
                new TypeInitializer(true, fhirService, nameof(IFhirService)),
                new TypeInitializer(true, fhirStructureDefinition, nameof(AbstractStructureDefinitionService))
            };

            var serviceAssemblies = AssemblyLoaderHelper.GetFhirServiceAssemblies();

            foreach (var asm in serviceAssemblies)
            {
                var types = asm.GetTypes();
                foreach (var classType in asm.GetTypes())
                {
                    BindIFhirServices(kernel, serviceTypes, classType);
                }
            }

            //}
            //catch (ReflectionTypeLoadException ex)
            //{
            //   ExceptionLogger.LogReflectionTypeLoadException(ex);
            //}

            CheckForLackingServices();
        }