/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ using System; using System.Collections.Generic; using Amazon.DynamoDBv2.Model; namespace Amazon.DynamoDBv2.DocumentModel { /// /// Configuration for the Table.PutItem operation /// public class TableConfig { /// /// Name of the table. /// public string TableName { get; set; } /// /// Conversion to use for converting .NET values to DynamoDB values. /// Default is AWSConfigs.DynamoDBConfig.ConversionSchema. /// public DynamoDBEntryConversion Conversion { get; set; } /// /// List of DateTime attributes that should be converted to epoch seconds /// before they are stored in DynamoDB. /// public List AttributesToStoreAsEpoch { get; set; } internal Table.DynamoDBConsumer Consumer { get; set; } internal bool IsEmptyStringValueEnabled { get; set; } /// /// Constructs TableConfig for a given table. /// Uses conversions schema AWSConfigs.DynamoDBConfig.ConversionSchema. /// /// Name of the table. public TableConfig(string tableName) : this(tableName, DynamoDBEntryConversion.CurrentConversion, Table.DynamoDBConsumer.DocumentModel, null, false) { } internal TableConfig(string tableName, DynamoDBEntryConversion conversion, Table.DynamoDBConsumer consumer, IEnumerable storeAsEpoch, bool isEmptyStringValueEnabled) { if (string.IsNullOrEmpty(tableName)) throw new ArgumentNullException("tableName"); TableName = tableName; Conversion = conversion; Consumer = consumer; IsEmptyStringValueEnabled = isEmptyStringValueEnabled; AttributesToStoreAsEpoch = new List(); if (storeAsEpoch != null) { AttributesToStoreAsEpoch.AddRange(storeAsEpoch); } } } }