Beispiel #1
0
        public override bool OnStart()
        {
            var azureSettings           = new AzureConfigurationSettings();
            var requestedProfileSetting = azureSettings.GetSetting(ProfileSetting);

            var endpointConfigurationType = GetEndpointConfigurationType(azureSettings);

            AssertThatEndpointConfigurationTypeHasDefaultConstructor(endpointConfigurationType);

            var specifier         = (IConfigureThisEndpoint)Activator.CreateInstance(endpointConfigurationType);
            var requestedProfiles = requestedProfileSetting.Split(' ');

            requestedProfiles = AddProfilesFromConfiguration(requestedProfiles);

            if (specifier is AsA_Host)
            {
                host = new DynamicHostController(specifier, requestedProfiles, new[] { typeof(Development) });
            }
            else
            {
                //var endpointName = "Put somethingt smart here Yves"; // wonder if I live up to the expectations :)
                var endpointName = RoleEnvironment.IsAvailable ? RoleEnvironment.CurrentRoleInstance.Role.Name : GetType().Name;
                host = new GenericHost(specifier, requestedProfiles, new[] { typeof(Development), typeof(OnAzureTableStorage) }, endpointName);
            }

            return(true);
        }
Beispiel #2
0
        public override bool OnStart()
        {
            var azureSettings     = new AzureConfigurationSettings();
            var requestedProfiles = azureSettings.GetSetting(ProfileSetting);

            var endpointConfigurationType = GetEndpointConfigurationType(azureSettings);

            AssertThatEndpointConfigurationTypeHasDefaultConstructor(endpointConfigurationType);

            var specifier = (IConfigureThisEndpoint)Activator.CreateInstance(endpointConfigurationType);

            genericHost = new GenericHost(specifier, requestedProfiles.Split(' '), null);

            return(true);
        }
Beispiel #3
0
        private static GenericHost StartHost()
        {
            Configure.WithWeb();

            var azureSettings     = new AzureConfigurationSettings();
            var requestedProfiles = azureSettings.GetSetting(ProfileSetting);

            var endpointConfigurationType = GetEndpointConfigurationType(azureSettings);

            AssertThatEndpointConfigurationTypeHasDefaultConstructor(endpointConfigurationType);

            var specifier = (IConfigureThisEndpoint)Activator.CreateInstance(endpointConfigurationType);

            var genericHost = new GenericHost(specifier, requestedProfiles.Split(' '), null);

            genericHost.Start();

            return(genericHost);
        }
Beispiel #4
0
        private static Type GetEndpointConfigurationType(AzureConfigurationSettings settings)
        {
            string endpoint = settings.GetSetting("EndpointConfigurationType");

            if (!String.IsNullOrEmpty(endpoint))
            {
                var endpointType = Type.GetType(endpoint, false);
                if (endpointType == null)
                {
                    throw new ConfigurationErrorsException(string.Format("The 'EndpointConfigurationType' entry in the role config has specified to use the type '{0}' but that type could not be loaded.", endpoint));
                }

                return(endpointType);
            }

            IEnumerable <Type> endpoints = ScanAssembliesForEndpoints();

            ValidateEndpoints(endpoints);

            return(endpoints.First());
        }