private static TableConnectionEntry ParseConnectionString(string connectionString)
        {
            var split = connectionString.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            var entry = new TableConnectionEntry();

            for (var i = 0; i < split.Length; i++)
            {
                var nvp = split[i].Split(new[] { '=' }, 2, StringSplitOptions.RemoveEmptyEntries);

                if (nvp.Length == 0)
                {
                    continue;
                }

                switch (nvp[0])
                {
                case nameof(entry.AccountKey):
                    entry.AccountKey = nvp[1];
                    break;

                case nameof(entry.AccountName):
                    entry.AccountName = nvp[1];
                    break;

                case nameof(entry.EndpointSuffix):
                    entry.EndpointSuffix = nvp[1];
                    break;
                }
            }
            return(entry);
        }
예제 #2
0
 internal TableCredentials(TableConnectionEntry entry)
 {
     _accountName = entry.AccountName;
     _key         = Convert.FromBase64String(entry.AccountKey);
 }