Example #1
0
        private ItemStorageConfig CreateStorageConfig(Type baseType, string actualTableName)
        {
            if (baseType == null)
            {
                throw new ArgumentNullException("baseType");
            }
            ITypeInfo         typeInfo = TypeFactory.GetTypeInfo(baseType);
            ItemStorageConfig config   = new ItemStorageConfig(typeInfo);

            PopulateConfigFromType(config, typeInfo);
            PopulateConfigFromMappings(config, AWSConfigsDynamoDB.Context.TypeMappings);

            // try to populate config from table definition only if actual table name is known
            if (!string.IsNullOrEmpty(actualTableName))
            {
                Table table;
                try
                {
                    table = Context.GetUnconfiguredTable(actualTableName);
                }
                catch
                {
                    table = null;
                }

                if (table != null)
                {
                    PopulateConfigFromTable(config, table);
                }
            }

            config.Denormalize(Context);
            return(config);
        }