Beispiel #1
0
 /// <summary>
 /// Throws an exception if the schema is invalid.
 /// </summary>
 /// <param name="tableSchema">The table schema.</param>
 public void ThrowIfSchemaInvalid(TableSchema tableSchema)
 {
     if(tableSchema.Columns.Any(column => string.IsNullOrEmpty(column.Name))) throw new ArgumentException(Resources.ErrorProvider_ColumnNameMissing);
 }
Beispiel #2
0
        /// <summary>
        ///    Builds a table creation URI.
        /// </summary>
        /// <param name="tableSchema">The table schema.</param>
        public string BuildTableSchemaAccess(TableSchema tableSchema)
        {
            if (tableSchema == null || string.IsNullOrEmpty(tableSchema.Name))
            {
                throw new ArgumentException(Resources.ResourceBuilder_MinimumForSchemaUpdateNotMet);
            }

            return new StringBuilder(tableSchema.Name).AppendFormat(_appendSegmentFormat, _schema).ToString();
        }
Beispiel #3
0
		/// <summary>
		///    Creates the table.
		/// </summary>
		/// <param name="tableSchema">The table schema.</param>
		public async Task CreateTableAsync(TableSchema tableSchema)
		{
			string resource = _resourceBuilder.BuildTableSchemaAccess(tableSchema);
			_errorProvider.ThrowIfSchemaInvalid(tableSchema);
			string data = _converter.ConvertSchema(tableSchema);
			IRestResponse response = await SendRequestAsync(Method.PUT, resource, Options.ContentType, Options.ContentType, data);
			_errorProvider.ThrowIfStatusMismatch(response, HttpStatusCode.OK);
		}
 private static void AssertSchemaValuesMatch(TableSchema requestedSchema, ExpectedSchemaUpdateRequestProperties properties)
 {
     requestedSchema.Name.Should().Be(properties.Table);
     requestedSchema.Columns.Should().HaveCount(1);
     requestedSchema.Columns[0].Name.Should().Be(properties.Column);
 }
        public string ConvertSchema(TableSchema schema)
        {
            if (_converter != null)
            {
                return _converter.ConvertSchema(schema);
            }

            throw new NotImplementedException();
        }