diff --git a/sdk/src/Services/DynamoDBv2/Custom/DataModel/BaseOperationConfig.cs b/sdk/src/Services/DynamoDBv2/Custom/DataModel/BaseOperationConfig.cs
index e8a5a5ea8759..73f976824695 100644
--- a/sdk/src/Services/DynamoDBv2/Custom/DataModel/BaseOperationConfig.cs
+++ b/sdk/src/Services/DynamoDBv2/Custom/DataModel/BaseOperationConfig.cs
@@ -41,30 +41,6 @@ public abstract class BaseOperationConfig
///
public string TableNamePrefix { get; set; }
- ///
- /// The object persistence model API relies on an internal cache of the DynamoDB table's metadata to
- /// construct and validate requests. This controls how the cache key is derived, which influences
- /// when the SDK will call DescribeTable internally to populate the cache.
- ///
- ///
- /// For the cache key will be a combination of the table name, credentials, region and service URL.
- /// For the cache key will only consist of the table name. This reduces cache misses in contexts
- /// where you are accessing tables with identical structure but using different credentials or endpoints (such as a multi-tenant application).
- ///
- public MetadataCachingMode? MetadataCachingMode { get; set; }
-
- ///
- /// If true disables fetching table metadata automatically from DynamoDB. Table metadata must be
- /// defined by attributes and/or in .
- ///
- ///
- /// Setting this to true can avoid latency and thread starvation due to blocking asynchronous
- /// DescribeTable calls that are used to populate the SDK's cache of table metadata.
- /// It requires that the table's index schema be accurately described via the above methods,
- /// otherwise exceptions may be thrown and/or the results of certain DynamoDB operations may change.
- ///
- public bool? DisableFetchingTableMetadata { get; set; }
-
///
/// Specification which controls the conversion between .NET and DynamoDB types.
///
@@ -91,8 +67,6 @@ internal virtual DynamoDBOperationConfig ToDynamoDBOperationConfig()
{
OverrideTableName = OverrideTableName,
TableNamePrefix = TableNamePrefix,
- MetadataCachingMode = MetadataCachingMode,
- DisableFetchingTableMetadata = DisableFetchingTableMetadata,
Conversion = Conversion,
IsEmptyStringValueEnabled = IsEmptyStringValueEnabled
};
diff --git a/sdk/src/Services/DynamoDBv2/Custom/DataModel/Configs.cs b/sdk/src/Services/DynamoDBv2/Custom/DataModel/Configs.cs
index 50d2a43b7514..da8406801bc1 100644
--- a/sdk/src/Services/DynamoDBv2/Custom/DataModel/Configs.cs
+++ b/sdk/src/Services/DynamoDBv2/Custom/DataModel/Configs.cs
@@ -191,18 +191,6 @@ public class DynamoDBOperationConfig
///
public string TableNamePrefix { get; set; }
- ///
- /// The object persistence model API relies on an internal cache of the DynamoDB table's metadata to construct and validate
- /// requests. This controls how the cache key is derived, which influences when the SDK will call
- /// IAmazonDynamoDB.DescribeTable(string) internally to populate the cache.
- ///
- ///
- /// For the cache key will be a combination of the table name, credentials, region and service URL.
- /// For the cache key will only consist of the table name. This reduces cache misses in contexts
- /// where you are accessing tables with identical structure but using different credentials or endpoints (such as a multi-tenant application).
- ///
- public MetadataCachingMode? MetadataCachingMode { get; set; }
-
///
/// Property that directs to ignore null values
/// on attributes during a Save operation.
@@ -225,18 +213,6 @@ public class DynamoDBOperationConfig
///
public DynamoDBEntryConversion Conversion { get; set; }
- ///
- /// If true disables fetching table metadata automatically from DynamoDB. Table metadata must be
- /// defined by attributes and/or in .
- ///
- ///
- /// Setting this to true can avoid latency and thread starvation due to blocking asynchronous
- /// IAmazonDynamoDB.DescribeTable(string) calls that are used to populate the SDK's cache of
- /// table metadata. It requires that the table's index schema be accurately described via the above methods,
- /// otherwise exceptions may be thrown and/or the results of certain DynamoDB operations may change.
- ///
- public bool? DisableFetchingTableMetadata { get; set; }
-
///
/// If true, all properties are retrieved in UTC timezone while reading data from DynamoDB. Else, the local timezone is used.
///
@@ -425,8 +401,7 @@ internal class DynamoDBFlatConfig
IndexName = null,
ConditionalOperator = ConditionalOperatorValues.And,
Conversion = null,
- IsEmptyStringValueEnabled = null,
- MetadataCachingMode = null
+ IsEmptyStringValueEnabled = null
};
private static DynamoDBContextConfig _emptyContextConfig = new DynamoDBContextConfig
{
@@ -450,20 +425,22 @@ public DynamoDBFlatConfig(DynamoDBOperationConfig operationConfig, DynamoDBConte
bool consistentRead = operationConfig.ConsistentRead ?? contextConfig.ConsistentRead ?? false;
bool skipVersionCheck = operationConfig.SkipVersionCheck ?? contextConfig.SkipVersionCheck ?? false;
bool ignoreNullValues = operationConfig.IgnoreNullValues ?? contextConfig.IgnoreNullValues ?? false;
- bool disableFetchingTableMetadata = operationConfig.DisableFetchingTableMetadata ?? contextConfig.DisableFetchingTableMetadata ?? false;
bool retrieveDateTimeInUtc = operationConfig.RetrieveDateTimeInUtc ?? contextConfig.RetrieveDateTimeInUtc ?? false;
bool isEmptyStringValueEnabled = operationConfig.IsEmptyStringValueEnabled ?? contextConfig.IsEmptyStringValueEnabled ?? false;
DynamoDBEntryConversion conversion = operationConfig.Conversion ?? contextConfig.Conversion ?? DynamoDBEntryConversion.CurrentConversion;
- MetadataCachingMode metadataCachingMode = operationConfig.MetadataCachingMode ?? contextConfig.MetadataCachingMode ?? DynamoDBv2.MetadataCachingMode.Default;
-
string tableNamePrefix =
!string.IsNullOrEmpty(operationConfig.TableNamePrefix) ? operationConfig.TableNamePrefix :
!string.IsNullOrEmpty(contextConfig.TableNamePrefix) ? contextConfig.TableNamePrefix : string.Empty;
- // These properties can only be set at the operation level, most are related to querying or scanning.
+ // These properties can only be set at the operation level
+ bool disableFetchingTableMetadata = contextConfig.DisableFetchingTableMetadata ?? false;
+ MetadataCachingMode metadataCachingMode = contextConfig.MetadataCachingMode ?? DynamoDBv2.MetadataCachingMode.Default;
+
// We don't support overriding the table name at the context level, since a context object can be used with multiple tables.
string overrideTableName =
!string.IsNullOrEmpty(operationConfig.OverrideTableName) ? operationConfig.OverrideTableName : string.Empty;
+
+ // The rest are related to querying or scanning, so only operation level
bool backwardQuery = operationConfig.BackwardQuery ?? false;
string indexName =
!string.IsNullOrEmpty(operationConfig.IndexName) ? operationConfig.IndexName : DefaultIndexName;
diff --git a/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DataModelOperationSpecificConfigTests.cs b/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DataModelOperationSpecificConfigTests.cs
index 583ca879b8f9..550c96a31a08 100644
--- a/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DataModelOperationSpecificConfigTests.cs
+++ b/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DataModelOperationSpecificConfigTests.cs
@@ -21,7 +21,7 @@ public void BaseOperationConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(6, typeof(BaseOperationConfig).GetProperties().Length);
+ Assert.AreEqual(4, typeof(BaseOperationConfig).GetProperties().Length);
}
[TestMethod]
@@ -29,7 +29,7 @@ public void BatchGetConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(8, typeof(BatchGetConfig).GetProperties().Length);
+ Assert.AreEqual(6, typeof(BatchGetConfig).GetProperties().Length);
}
[TestMethod]
@@ -62,7 +62,7 @@ public void BatchWriteConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(8, typeof(BatchWriteConfig).GetProperties().Length);
+ Assert.AreEqual(6, typeof(BatchWriteConfig).GetProperties().Length);
}
[TestMethod]
@@ -95,7 +95,7 @@ public void TransactGetConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(TransactGetConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(TransactGetConfig).GetProperties().Length);
}
[TestMethod]
@@ -128,7 +128,7 @@ public void TransactWriteConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(TransactWriteConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(TransactWriteConfig).GetProperties().Length);
}
[TestMethod]
@@ -161,7 +161,7 @@ public void QueryConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(12, typeof(QueryConfig).GetProperties().Length);
+ Assert.AreEqual(10, typeof(QueryConfig).GetProperties().Length);
}
[TestMethod]
@@ -193,7 +193,7 @@ public void FromQueryConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(FromQueryConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(FromQueryConfig).GetProperties().Length);
}
[TestMethod]
@@ -230,7 +230,7 @@ public void ScanConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(11, typeof(ScanConfig).GetProperties().Length);
+ Assert.AreEqual(9, typeof(ScanConfig).GetProperties().Length);
}
[TestMethod]
@@ -262,7 +262,7 @@ public void FromScanConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(FromScanConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(FromScanConfig).GetProperties().Length);
}
[TestMethod]
@@ -294,7 +294,7 @@ public void DeleteConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(DeleteConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(DeleteConfig).GetProperties().Length);
}
[TestMethod]
@@ -325,7 +325,7 @@ public void SaveConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(8, typeof(SaveConfig).GetProperties().Length);
+ Assert.AreEqual(6, typeof(SaveConfig).GetProperties().Length);
}
[TestMethod]
@@ -356,7 +356,7 @@ public void LoadConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(8, typeof(LoadConfig).GetProperties().Length);
+ Assert.AreEqual(6, typeof(LoadConfig).GetProperties().Length);
}
[TestMethod]
@@ -387,7 +387,7 @@ public void ToDocumentConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(ToDocumentConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(ToDocumentConfig).GetProperties().Length);
}
[TestMethod]
@@ -395,7 +395,7 @@ public void FromDocumentConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(7, typeof(FromDocumentConfig).GetProperties().Length);
+ Assert.AreEqual(5, typeof(FromDocumentConfig).GetProperties().Length);
}
[TestMethod]
@@ -403,7 +403,7 @@ public void GetTargetTableConfig()
{
// If this fails because you've added a property, be sure to add it to
// `ToDynamoDBOperationConfig` before updating this unit test
- Assert.AreEqual(6, typeof(GetTargetTableConfig).GetProperties().Length);
+ Assert.AreEqual(4, typeof(GetTargetTableConfig).GetProperties().Length);
}
[DynamoDBTable("TableName")]
diff --git a/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DynamoDBTests.cs b/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DynamoDBTests.cs
index 7c300dc891de..adeec52799c8 100644
--- a/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DynamoDBTests.cs
+++ b/sdk/test/Services/DynamoDBv2/UnitTests/Custom/DynamoDBTests.cs
@@ -451,17 +451,16 @@ public void DisableFetchingTableMetadata_QueryWithMissingHashKey_ThrowsException
[TestCategory("DynamoDBv2")]
public void DisableFetchingTableMetadata_QueryWithMissingRangeKey_ThrowsException()
{
- // For variety, use the operation-level override
- var config = new DynamoDBOperationConfig()
+ var config = new DynamoDBContextConfig()
{
DisableFetchingTableMetadata = true
};
- var context = new DynamoDBContext(new Mock().Object);
+ var context = new DynamoDBContext(new Mock().Object, config);
// This is the table's range key, which is not attributed
Assert.ThrowsException(() =>
- context.Query("123", QueryOperator.GreaterThan, 5, config));
+ context.Query("123", QueryOperator.GreaterThan, 5));
// This is a GSI's range key, which is not attributed
Assert.ThrowsException(() =>