Elastacloud.AzureManagement.Fluent.Clients.MobileServiceClient.CreateMobileServiceWithNewDb C# (CSharp) 메소드

CreateMobileServiceWithNewDb() 공개 메소드

Used to create a new mobile service
public CreateMobileServiceWithNewDb ( string serviceName, string sqlUsername, string sqlPassword ) : void
serviceName string The name of the mobile service
sqlUsername string the name of the sql user
sqlPassword string The sql password
리턴 void
        public void CreateMobileServiceWithNewDb(string serviceName, string sqlUsername, string sqlPassword)
        {
            MobileServiceName = serviceName;
            SqlAzureUsername = sqlUsername;
            SqlAzurePassword = sqlPassword;
            EnsureMobileServicesName();
            MobileServiceCommand command = new CreateMobileServiceCommand(serviceName, null)
                              {
                                  SubscriptionId = SubscriptionId,
                                  Certificate = ManagementCertificate
                              };
            BuildBase64Config(ref command);
            command.Execute();
            Refresh();
            // if the mobile service is not properly created we don't want to leave this lingering so delete it and all resources
            // associated with it
            if (MobileServiceState == State.UnHealthy)
            {
                Delete();
            }
        }

Usage Example

예제 #1
0
        public void Execute()
        {
            System.Console.WriteLine("Create mobile service");
            System.Console.WriteLine("=====================");

            var client = new MobileServiceClient(_subscriptionId, _certificate);
            client.CreateMobileServiceWithNewDb(_mobileServiceName, "supersqluser", "Testable123");

            System.Console.WriteLine("Application key: {0}", client.ApplicationKey);
            System.Console.WriteLine("Application url: {0}", client.ApplicationUrl);
            System.Console.WriteLine("Description: {0}", client.Description);
            System.Console.WriteLine("Location: {0}", client.Location);
            System.Console.WriteLine("Master key: {0}", client.MasterKey);
            System.Console.WriteLine("Mobile service Db name: {0}", client.MobileServiceDbName);
            System.Console.WriteLine("Mobile service server name: {0}", client.MobileServiceSqlName);
            System.Console.WriteLine("Sql Azure Db name: {0}", client.SqlAzureDbName);
            System.Console.WriteLine("Sql Azure server name: {0}", client.SqlAzureServerName);
            System.Console.WriteLine("Mobile service state: {0}", client.MobileServiceState.ToString());
        }