コード例 #1
0
        public ValidationProvider(IHostingEnvironment hostingEnvironment)
        {
            this.hostingEnvironment = hostingEnvironment;
            string configPath = Path.Combine(this.hostingEnvironment.GetPrivateRoot(), "config.json");

            this.configurationConstants = JsonConvert.DeserializeObject <ConfigurationConstants>(System.IO.File.ReadAllText(configPath));
        }
コード例 #2
0
        public string GetIdentityProvidersInfoEndpoint(string realm, string returnUrl)
        {
            var acsNamespace          = ConfigurationManager.AppSettings["AcsNamespace"];
            var identityProvidersInfo = ConfigurationConstants.GetIdentityProvidersInfoEndpoint(acsNamespace, realm, returnUrl ?? string.Empty);

            return(identityProvidersInfo);
        }
コード例 #3
0
        ///Use 'name' from ConfigurationConstants!
        public ConfigurationObject ReadOrDefaultConfigurationObject(string name)
        {
            var currentObject = _databaseAdapter.GetConfigurationObject(name);

            return(currentObject ?? ConfigurationObject.CreateConfiguration(name,
                                                                            ConfigurationConstants.GetDefault(name)));
        }
コード例 #4
0
        protected override ISqlDatabaseManagement CreateChannel()
        {
            // If ShareChannel is set by a unit test, use the same channel that
            // was passed into out constructor.  This allows the test to submit
            // a mock that we use for all network calls.
            if (ShareChannel)
            {
                return(Channel);
            }

            if (this.ServiceBinding == null)
            {
                this.ServiceBinding = ConfigurationConstants.WebHttpBinding(this.MaxStringContentLength);
            }

            if (string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint))
            {
                this.ServiceEndpoint = ConfigurationConstants.ServiceManagementEndpoint;
            }
            else
            {
                this.ServiceEndpoint = CurrentSubscription.ServiceEndpoint;
            }

            return(SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel(this.ServiceBinding, new Uri(this.ServiceEndpoint), CurrentSubscription.Certificate, this.clientRequestId));
        }
コード例 #5
0
 /// <summary>
 /// Creates new instance from ServiceBusClientExtensions
 /// </summary>
 /// <param name="subscription"></param>
 /// <param name="logger">The logger action</param>
 public ServiceBusClientExtensions(SubscriptionData subscription, Action <string> logger = null)
 {
     subscriptionId = subscription.SubscriptionId;
     Subscription   = subscription;
     Logger         = logger;
     ServiceBusManagementChannel = ChannelHelper.CreateServiceManagementChannel <IServiceBusManagement>(
         ConfigurationConstants.WebHttpBinding(),
         new Uri(subscription.ServiceEndpoint),
         subscription.Certificate,
         new HttpRestMessageInspector(logger));
 }
コード例 #6
0
        public ConfigurationObject ReadConfigurationObject(string name)
        {
            //var objectFromDB = _databaseAdapter.GetConfigurationObjectOld(name);
            var objectFromDB = _databaseAdapter.GetConfigurationObject(name);

            if (objectFromDB != null)
            {
                objectFromDB.Description = ConfigurationConstants.GetDescription(name);
            }
            return(objectFromDB);
        }
コード例 #7
0
        protected override IServiceManagement CreateChannel()
        {
            if (ServiceBinding == null)
            {
                ServiceBinding = ConfigurationConstants.WebHttpBinding();
            }

            ServiceEndpoint = string.IsNullOrEmpty(CurrentSubscription.ServiceEndpoint)
                ? ConfigurationConstants.ServiceManagementEndpoint
                : CurrentSubscription.ServiceEndpoint;

            return(ServiceManagementHelper.CreateServiceManagementChannel(ServiceBinding, new Uri(ServiceEndpoint), CurrentSubscription.Certificate));
        }
コード例 #8
0
 /// <summary>
 /// Creates a channel for communication with the server.
 /// </summary>
 /// <returns>a new channel to use for communication</returns>
 private ISqlDatabaseManagement GetManagementChannel()
 {
     if (this.Channel == null)
     {
         //create a channel to the server for communication
         ISqlDatabaseManagement channel = SqlDatabaseManagementHelper.CreateSqlDatabaseManagementChannel(
             ConfigurationConstants.WebHttpBinding(ConfigurationConstants.MaxStringContentLength),
             this.serviceEndpoint,
             this.certificate,
             this.clientRequestId);
         this.Channel = channel;
     }
     return(this.Channel);
 }
コード例 #9
0
 protected override IGatewayServiceManagement CreateChannel()
 {
     if (base.get_ServiceBinding() == null)
     {
         base.set_ServiceBinding(ConfigurationConstants.WebHttpBinding());
     }
     if (!string.IsNullOrEmpty(base.get_CurrentSubscription().get_ServiceEndpoint()))
     {
         base.set_ServiceEndpoint(base.get_CurrentSubscription().get_ServiceEndpoint());
     }
     else
     {
         base.set_ServiceEndpoint("https://management.core.windows.net");
     }
     return(GatewayManagementHelper.CreateGatewayManagementChannel(base.get_ServiceBinding(), new Uri(base.get_ServiceEndpoint()), base.get_CurrentSubscription().get_Certificate()));
 }
コード例 #10
0
        /// <summary>
        /// Creates new WebsitesClient.
        /// </summary>
        /// <param name="subscription">The Windows Azure subscription data object</param>
        /// <param name="logger">The logger action</param>
        public WebsitesClient(SubscriptionData subscription, Action <string> logger)
        {
            SubscriptionId = subscription.SubscriptionId;
            Logger         = logger;
            WebsiteChannel = ServiceManagementHelper.CreateServiceManagementChannel <IWebsitesServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                new HttpRestMessageInspector(logger));

            ServiceManagementChannel = ServiceManagementHelper.CreateServiceManagementChannel <IServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                new HttpRestMessageInspector(logger));
        }
コード例 #11
0
 /// <summary>
 /// Creates new instance from CloudServiceClient.
 /// </summary>
 /// <param name="subscription">The subscription data</param>
 /// <param name="debugStream">Action used to log http requests/responses</param>
 /// <param name="verboseStream">Action used to log detailed client progress</param>
 /// <param name="warningStream">Action used to log warning messages</param>
 public CloudServiceClient(
     SubscriptionData subscription,
     string currentLocation        = null,
     Action <string> debugStream   = null,
     Action <string> verboseStream = null,
     Action <string> warningStream = null)
 {
     Subscription             = subscription;
     subscriptionId           = subscription.SubscriptionId;
     CurrentDirectory         = currentLocation;
     DebugStream              = debugStream;
     VerboseStream            = verboseStream;
     WarningeStream           = warningStream;
     HeadersInspector         = new HeadersInspector();
     ServiceManagementChannel = ServiceManagementHelper.CreateServiceManagementChannel <IServiceManagement>(
         ConfigurationConstants.WebHttpBinding(),
         new Uri(subscription.ServiceEndpoint),
         subscription.Certificate,
         new HttpRestMessageInspector(DebugStream),
         HeadersInspector);
     CloudBlobUtility = new CloudBlobUtility();
 }
コード例 #12
0
        /// <summary>
        /// Creates new instance from the store client.
        /// </summary>
        /// <param name="subscriptionId">The Windows Azure subscription id</param>
        /// <param name="storeEndpointUri">The service management endpoint uri</param>
        /// <param name="cert">The authentication certificate</param>
        /// <param name="logger">The logger for http request/response</param>
        /// <param name="serviceManagementChannel">The service management channel</param>
        public StoreClient(
            string subscriptionId,
            string storeEndpointUri,
            X509Certificate2 cert,
            Action <string> logger,
            IServiceManagement serviceManagementChannel)
        {
            Validate.ValidateStringIsNullOrEmpty(storeEndpointUri, null, true);
            Validate.ValidateStringIsNullOrEmpty(subscriptionId, null, true);
            Validate.ValidateNullArgument(cert, Resources.NullCertificateMessage);

            this.subscriptionId = subscriptionId;
            headersInspector    = new HeadersInspector();
            storeChannel        = ServiceManagementHelper.CreateServiceManagementChannel <IStoreManagement>(
                ConfigurationConstants.WebHttpBinding(0),
                new Uri(storeEndpointUri),
                cert,
                new HttpRestMessageInspector(logger),
                headersInspector);
            this.serviceManagementChannel = serviceManagementChannel;
            MarketplaceClient             = new MarketplaceClient();
        }
コード例 #13
0
        /// <summary>
        /// Creates new WebsitesClient.
        /// </summary>
        /// <param name="subscription">The Windows Azure subscription data object</param>
        /// <param name="logger">The logger action</param>
        public WebsitesClient(SubscriptionData subscription, Action <string> logger)
        {
            subscriptionId   = subscription.SubscriptionId;
            Subscription     = subscription;
            Logger           = logger;
            HeadersInspector = new HeadersInspector();
            HeadersInspector.RequestHeaders.Add(ServiceManagement.Constants.VersionHeaderName, WebsitesServiceVersion);
            HeadersInspector.RequestHeaders.Add(ApiConstants.UserAgentHeaderName, ApiConstants.UserAgentHeaderValue);
            HeadersInspector.RemoveHeaders.Add(ApiConstants.VSDebuggerCausalityDataHeaderName);
            WebsiteChannel = ChannelHelper.CreateChannel <IWebsitesServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                HeadersInspector,
                new HttpRestMessageInspector(logger));

            ServiceManagementChannel = ChannelHelper.CreateServiceManagementChannel <IServiceManagement>(
                ConfigurationConstants.WebHttpBinding(),
                new Uri(subscription.ServiceEndpoint),
                subscription.Certificate,
                new HttpRestMessageInspector(logger));

            cloudServiceClient = new CloudServiceClient(subscription, debugStream: logger);
        }
コード例 #14
0
        private void FieldForm_Load(object sender, EventArgs e)
        {
            //Блоки констант
            foreach (string constantsBlockName in Program.Kernel.Conf.ConstantsBlock.Keys)
            {
                comboBoxBlock.Items.Add(constantsBlockName);
            }

            if (comboBoxBlock.Items.Count > 0)
            {
                comboBoxBlock.SelectedItem = comboBoxBlock.Items[0];
            }

            //Типи даних
            foreach (FieldType fieldType in FieldType.DefaultList())
            {
                comboBoxFieldType.Items.Add(fieldType);
            }

            comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[0];
            comboBoxPointer.Enabled        = false;
            comboBoxEnums.Enabled          = false;

            //Список довідників
            foreach (string directoryName in Program.Kernel.Conf.Directories.Keys)
            {
                comboBoxPointer.Items.Add("Довідники." + directoryName);
            }

            //Список документів
            foreach (string documentName in Program.Kernel.Conf.Documents.Keys)
            {
                comboBoxPointer.Items.Add("Документи." + documentName);
            }

            //Список перелічення
            foreach (string enumName in Program.Kernel.Conf.Enums.Keys)
            {
                comboBoxEnums.Items.Add("Перелічення." + enumName);
            }

            if (Constants == null)
            {
                Constants = new ConfigurationConstants();
                textBoxNameInTable.Text = NewNameInTable;
                IsNew = true;

                SelectBlockItem();
            }
            else
            {
                OriginalName   = Constants.Name;
                ConstantsBlock = Constants.Block.BlockName;

                textBoxName.Text        = Constants.Name;
                textBoxNameInTable.Text = Constants.NameInTable;
                textBoxDesc.Text        = Constants.Desc;

                SelectBlockItem();

                for (int i = 0; i < comboBoxFieldType.Items.Count; i++)
                {
                    FieldType fieldType = (FieldType)comboBoxFieldType.Items[i];
                    if (fieldType.ConfTypeName == Constants.Type)
                    {
                        comboBoxFieldType.SelectedItem = comboBoxFieldType.Items[i];
                        break;
                    }
                }

                string confTypeName = ((FieldType)comboBoxFieldType.SelectedItem).ConfTypeName;

                if (confTypeName == "pointer")
                {
                    for (int i = 0; i < comboBoxPointer.Items.Count; i++)
                    {
                        if (Constants.Pointer == comboBoxPointer.Items[i].ToString())
                        {
                            comboBoxPointer.SelectedItem = comboBoxPointer.Items[i];
                            break;
                        }
                    }
                }
                else if (confTypeName == "enum")
                {
                    for (int i = 0; i < comboBoxEnums.Items.Count; i++)
                    {
                        if (Constants.Pointer == comboBoxEnums.Items[i].ToString())
                        {
                            comboBoxEnums.SelectedItem = comboBoxEnums.Items[i];
                            break;
                        }
                    }
                }

                LoadTabularPartsList();

                IsNew = false;
            }
        }