using Amazon.DynamoDBv2; using Amazon.Util.Internal; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Xml; using System.Xml.Linq; namespace Amazon.Util { internal class DynamoDBSectionRoot { private const string dynamoDBKey = "dynamoDB"; public DynamoDBSectionRoot(XElement section) { this.DynamoDB = AWSConfigs.GetObject(section, dynamoDBKey); } public DynamoDBSection DynamoDB { get; private set; } } /// /// Root DynamoDB section /// internal class DynamoDBSection : ConfigurationElement { public DynamoDBContextSection DynamoDBContext { get; private set; } /// /// Alternate property for DynamoDBSection.DynamoDBContext, this /// property is referred by AWSConfigsDynamoDB to load values. /// public DynamoDBContextSection Context { get { return this.DynamoDBContext; } } public ConversionSchema ConversionSchema { get; private set; } } /// /// DynamoDBContext section /// internal class DynamoDBContextSection : ConfigurationElement { public DynamoDBContextSection() { this.TableAliases = new TableAliasesCollection(); this.Mappings = new TypeMappingsCollection(); } public string TableNamePrefix { get; private set; } public TableAliasesCollection TableAliases { get; private set; } public TypeMappingsCollection Mappings { get; private set; } /// /// Alternate property for DynamoDBContextSection.Mappings, this /// property is referred by DynamoDBContextConfig to load values. /// public TypeMappingsCollection TypeMappings { get { return this.Mappings; } } } /// /// Single DDB table alias /// internal class TableAliasElement : ConfigurationElement { public string FromTable { get; private set; } public string ToTable { get; private set; } } /// /// Collection of DDB table aliases /// internal class TableAliasesCollection : ConfigurationList { public string ItemPropertyName { get { return "alias"; } } } /// /// Single DDB type mapping config /// internal class TypeMappingElement : ConfigurationElement { public TypeMappingElement() { this.PropertyConfigs = new PropertyConfigsCollection(); } public Type Type { get; private set; } public string TargetTable { get; private set; } public PropertyConfigsCollection PropertyConfigs { get; private set; } } /// /// Collection of DDB type mapping configs /// internal class TypeMappingsCollection : ConfigurationList { public string ItemPropertyName { get { return "map"; } } } /// /// Single DDB property mapping config /// internal class PropertyConfigElement : ConfigurationElement { public string Name { get; private set; } public string Attribute { get; private set; } public bool? Ignore { get; private set; } public bool? Version { get; private set; } public Type Converter { get; private set; } public bool? StoreAsEpoch { get; set; } } /// /// Collection of DDB property mapping configs /// internal class PropertyConfigsCollection : ConfigurationList { public string ItemPropertyName { get { return "property"; } } } }