diff --git a/src/Microsoft.OData.Core/PublicAPI/net45/PublicAPI.Unshipped.txt b/src/Microsoft.OData.Core/PublicAPI/net45/PublicAPI.Unshipped.txt
index 5f282702bb..b39dc0b6f6 100644
--- a/src/Microsoft.OData.Core/PublicAPI/net45/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.OData.Core/PublicAPI/net45/PublicAPI.Unshipped.txt
@@ -1 +1,2 @@
-
\ No newline at end of file
+override Microsoft.OData.ODataEnumValue.ToString() -> string
+override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
\ No newline at end of file
diff --git a/src/Microsoft.OData.Core/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt b/src/Microsoft.OData.Core/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt
index 5f282702bb..b39dc0b6f6 100644
--- a/src/Microsoft.OData.Core/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.OData.Core/PublicAPI/netcoreapp3.1/PublicAPI.Unshipped.txt
@@ -1 +1,2 @@
-
\ No newline at end of file
+override Microsoft.OData.ODataEnumValue.ToString() -> string
+override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
\ No newline at end of file
diff --git a/src/Microsoft.OData.Core/PublicAPI/netstandard1.1/PublicAPI.Unshipped.txt b/src/Microsoft.OData.Core/PublicAPI/netstandard1.1/PublicAPI.Unshipped.txt
index 5f282702bb..b39dc0b6f6 100644
--- a/src/Microsoft.OData.Core/PublicAPI/netstandard1.1/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.OData.Core/PublicAPI/netstandard1.1/PublicAPI.Unshipped.txt
@@ -1 +1,2 @@
-
\ No newline at end of file
+override Microsoft.OData.ODataEnumValue.ToString() -> string
+override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
\ No newline at end of file
diff --git a/src/Microsoft.OData.Core/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt b/src/Microsoft.OData.Core/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
index 5f282702bb..b39dc0b6f6 100644
--- a/src/Microsoft.OData.Core/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
+++ b/src/Microsoft.OData.Core/PublicAPI/netstandard2.0/PublicAPI.Unshipped.txt
@@ -1 +1,2 @@
-
\ No newline at end of file
+override Microsoft.OData.ODataEnumValue.ToString() -> string
+override Microsoft.OData.ODataPrimitiveValue.ToString() -> string
\ No newline at end of file
diff --git a/src/Microsoft.OData.Core/Value/ODataEnumValue.cs b/src/Microsoft.OData.Core/Value/ODataEnumValue.cs
index 9df7a507ef..8002f83117 100644
--- a/src/Microsoft.OData.Core/Value/ODataEnumValue.cs
+++ b/src/Microsoft.OData.Core/Value/ODataEnumValue.cs
@@ -33,5 +33,14 @@ public ODataEnumValue(string value, string typeName)
/// Get the type name in edm model.
public string TypeName { get; private set; }
+
+ ///
+ /// Returns a string that represents the current enum.
+ ///
+ /// A string that represents the current enum.
+ public override string ToString()
+ {
+ return Value;
+ }
}
}
diff --git a/src/Microsoft.OData.Core/Value/ODataPrimitiveValue.cs b/src/Microsoft.OData.Core/Value/ODataPrimitiveValue.cs
index 50f88c3ed4..ad81443ea4 100644
--- a/src/Microsoft.OData.Core/Value/ODataPrimitiveValue.cs
+++ b/src/Microsoft.OData.Core/Value/ODataPrimitiveValue.cs
@@ -39,5 +39,14 @@ public ODataPrimitiveValue(object value)
///
/// The underlying primitive CLR value.
public object Value { get; private set; }
+
+ ///
+ /// Returns a string that represents the current primitve.
+ ///
+ /// A string that represents the current primitve.
+ public override string ToString()
+ {
+ return Value.ToString();
+ }
}
}
\ No newline at end of file
diff --git a/test/FunctionalTests/Microsoft.OData.Core.Tests/ODataValueUtilsTests.cs b/test/FunctionalTests/Microsoft.OData.Core.Tests/ODataValueUtilsTests.cs
index 62e2d14a9c..b98c97c226 100644
--- a/test/FunctionalTests/Microsoft.OData.Core.Tests/ODataValueUtilsTests.cs
+++ b/test/FunctionalTests/Microsoft.OData.Core.Tests/ODataValueUtilsTests.cs
@@ -16,6 +16,8 @@ public void SingleEnumToODataValue()
{
var enumValue = Feature.Feature1.ToODataValue() as ODataEnumValue;
Assert.Equal("Feature1", enumValue.Value);
+
+ Assert.Equal("Feature1", enumValue.ToString());
}
[Fact]
diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl
index 8c79296bdf..f07121f141 100644
--- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl
+++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.net45.bsl
@@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue
string TypeName { public get; }
string Value { public get; }
+
+ public virtual string ToString ()
}
[
@@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)
object Value { public get; }
+
+ public virtual string ToString ()
}
public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {
diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl
index a4ec854ecb..c30f3b01e8 100644
--- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl
+++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard1.1.bsl
@@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue
string TypeName { public get; }
string Value { public get; }
+
+ public virtual string ToString ()
}
[
@@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)
object Value { public get; }
+
+ public virtual string ToString ()
}
public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {
diff --git a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl
index 8c79296bdf..f07121f141 100644
--- a/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl
+++ b/test/PublicApiTests/BaseLine/Microsoft.OData.PublicApi.netstandard2.0.bsl
@@ -5323,6 +5323,8 @@ public sealed class Microsoft.OData.ODataEnumValue : Microsoft.OData.ODataValue
string TypeName { public get; }
string Value { public get; }
+
+ public virtual string ToString ()
}
[
@@ -5658,6 +5660,8 @@ public sealed class Microsoft.OData.ODataPrimitiveValue : Microsoft.OData.ODataV
public ODataPrimitiveValue (object value)
object Value { public get; }
+
+ public virtual string ToString ()
}
public sealed class Microsoft.OData.ODataProperty : Microsoft.OData.ODataPropertyInfo {