-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cosmos: Add API to configure TTL and throughput
- Loading branch information
1 parent
428c37d
commit 70b2d0f
Showing
34 changed files
with
1,118 additions
and
198 deletions.
There are no files selected for viewing
3 changes: 0 additions & 3 deletions
3
src/EFCore.Abstractions/Properties/AbstractionsStrings.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/EFCore.Cosmos/Design/Internal/CosmosCSharpRuntimeAnnotationCodeGenerator.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using Microsoft.EntityFrameworkCore.Cosmos.Metadata.Internal; | ||
using Microsoft.EntityFrameworkCore.Design.Internal; | ||
using Microsoft.EntityFrameworkCore.Metadata; | ||
|
||
namespace Microsoft.EntityFrameworkCore.Cosmos.Design.Internal | ||
{ | ||
/// <summary> | ||
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to | ||
/// the same compatibility standards as public APIs. It may be changed or removed without notice in | ||
/// any release. You should only use it directly in your code with extreme caution and knowing that | ||
/// doing so can result in application failures when updating to a new Entity Framework Core release. | ||
/// </summary> | ||
#pragma warning disable EF1001 // Internal EF Core API usage. | ||
public class CosmosCSharpRuntimeAnnotationCodeGenerator : CSharpRuntimeAnnotationCodeGenerator | ||
{ | ||
/// <summary> | ||
/// This is an internal API that supports the Entity Framework Core infrastructure and not subject to | ||
/// the same compatibility standards as public APIs. It may be changed or removed without notice in | ||
/// any release. You should only use it directly in your code with extreme caution and knowing that | ||
/// doing so can result in application failures when updating to a new Entity Framework Core release. | ||
/// </summary> | ||
public CosmosCSharpRuntimeAnnotationCodeGenerator( | ||
CSharpRuntimeAnnotationCodeGeneratorDependencies dependencies) | ||
: base(dependencies) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void Generate(IModel model, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) | ||
{ | ||
var annotations = parameters.Annotations; | ||
if (!parameters.IsRuntime) | ||
{ | ||
annotations.Remove(CosmosAnnotationNames.Throughput); | ||
} | ||
|
||
base.Generate(model, parameters); | ||
} | ||
|
||
/// <inheritdoc /> | ||
public override void Generate(IEntityType entityType, CSharpRuntimeAnnotationCodeGeneratorParameters parameters) | ||
{ | ||
var annotations = parameters.Annotations; | ||
if (!parameters.IsRuntime) | ||
{ | ||
annotations.Remove(CosmosAnnotationNames.AnalyticalStoreTimeToLive); | ||
annotations.Remove(CosmosAnnotationNames.DefaultTimeToLive); | ||
annotations.Remove(CosmosAnnotationNames.Throughput); | ||
} | ||
|
||
base.Generate(entityType, parameters); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.