-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into users/akotalwar/TurnOnODEByDefault
- Loading branch information
Showing
53 changed files
with
5,362 additions
and
374 deletions.
There are no files selected for viewing
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
1,611 changes: 1,611 additions & 0 deletions
1,611
Microsoft.Azure.Cosmos/contracts/API_3.37.1-preview.txt
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
56 changes: 56 additions & 0 deletions
56
Microsoft.Azure.Cosmos/src/Linq/CustomCosmosLinqSerializer.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,56 @@ | ||
//------------------------------------------------------------ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
//------------------------------------------------------------ | ||
namespace Microsoft.Azure.Cosmos.Linq | ||
{ | ||
using System; | ||
using System.Globalization; | ||
using System.IO; | ||
using System.Linq.Expressions; | ||
using System.Reflection; | ||
|
||
internal class CustomCosmosLinqSerializer : ICosmosLinqSerializerInternal | ||
{ | ||
private readonly CosmosLinqSerializer CustomCosmosSerializer; | ||
|
||
public CustomCosmosLinqSerializer(CosmosLinqSerializer customCosmosLinqSerializer) | ||
{ | ||
this.CustomCosmosSerializer = customCosmosLinqSerializer; | ||
} | ||
|
||
public bool RequiresCustomSerialization(MemberExpression memberExpression, Type memberType) | ||
{ | ||
return true; | ||
} | ||
|
||
public string Serialize(object value, MemberExpression memberExpression, Type memberType) | ||
{ | ||
return this.SerializeWithCustomSerializer(value); | ||
} | ||
|
||
public string SerializeScalarExpression(ConstantExpression inputExpression) | ||
{ | ||
return this.SerializeWithCustomSerializer(inputExpression.Value); | ||
} | ||
|
||
public string SerializeMemberName(MemberInfo memberInfo) | ||
{ | ||
return this.CustomCosmosSerializer.SerializeMemberName(memberInfo); | ||
} | ||
|
||
private string SerializeWithCustomSerializer(object value) | ||
{ | ||
StringWriter writer = new StringWriter(CultureInfo.InvariantCulture); | ||
|
||
using (Stream stream = this.CustomCosmosSerializer.ToStream(value)) | ||
{ | ||
using (StreamReader streamReader = new StreamReader(stream)) | ||
{ | ||
string propertyValue = streamReader.ReadToEnd(); | ||
writer.Write(propertyValue); | ||
return writer.ToString(); | ||
} | ||
} | ||
} | ||
} | ||
} |
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
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
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.