Skip to content

Commit 6b901d8

Browse files
committed
Remove JsonObjectSerilizer and have storage helpers requiere a serilizer
1 parent 5553f45 commit 6b901d8

File tree

4 files changed

+7
-39
lines changed

4 files changed

+7
-39
lines changed

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/BaseObjectStorageHelper.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,13 @@ public abstract class BaseObjectStorageHelper : IObjectStorageHelper
2121
/// <summary>
2222
/// Initializes a new instance of the <see cref="BaseObjectStorageHelper"/> class,
2323
/// which can read and write data using the provided <see cref="IObjectSerializer"/>;
24-
/// if none is provided, a default Json serializer will be used (based on <see cref="DataContractSerializer"/>).
25-
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json and the new default Serializer may behave differently.
24+
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json.
2625
/// To implement a <see cref="IObjectSerializer"/> based on Newtonsoft.Json or System.Text.Json see https://aka.ms/wct/storagehelper-migration
2726
/// </summary>
2827
/// <param name="objectSerializer">The serializer to use.</param>
29-
public BaseObjectStorageHelper(IObjectSerializer objectSerializer = null)
28+
public BaseObjectStorageHelper(IObjectSerializer objectSerializer)
3029
{
31-
serializer = objectSerializer ?? new JsonObjectSerializer();
30+
serializer = objectSerializer ?? throw new ArgumentNullException(nameof(objectSerializer));
3231
}
3332

3433
/// <summary>

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/JsonObjectSerializer.cs

Lines changed: 0 additions & 29 deletions
This file was deleted.

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/LocalObjectStorageHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ public class LocalObjectStorageHelper : BaseObjectStorageHelper
1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="LocalObjectStorageHelper"/> class,
1717
/// which can read and write data using the provided <see cref="IObjectSerializer"/>;
18-
/// if none is provided, a default Json serializer will be used (based on <see cref="DataContractSerializer"/>).
19-
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json and the new default Serializer may behave differently.
18+
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json.
2019
/// To implement a <see cref="IObjectSerializer"/> based on Newtonsoft.Json or System.Text.Json see https://aka.ms/wct/storagehelper-migration
2120
/// </summary>
2221
/// <param name="objectSerializer">The serializer to use.</param>
23-
public LocalObjectStorageHelper(IObjectSerializer objectSerializer = null)
22+
public LocalObjectStorageHelper(IObjectSerializer objectSerializer)
2423
: base(objectSerializer)
2524
{
2625
Settings = ApplicationData.Current.LocalSettings;

Microsoft.Toolkit.Uwp/Helpers/ObjectStorage/RoamingObjectStorageHelper.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ public class RoamingObjectStorageHelper : BaseObjectStorageHelper
1515
/// <summary>
1616
/// Initializes a new instance of the <see cref="RoamingObjectStorageHelper"/> class,
1717
/// which can read and write data using the provided <see cref="IObjectSerializer"/>;
18-
/// if none is provided, a default Json serializer will be used (based on <see cref="DataContractSerializer"/>).
19-
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json and the new default Serializer may behave differently.
18+
/// In 6.1 and older the default Serializer was based on Newtonsoft.Json.
2019
/// To implement a <see cref="IObjectSerializer"/> based on Newtonsoft.Json or System.Text.Json see https://aka.ms/wct/storagehelper-migration
2120
/// </summary>
2221
/// <param name="objectSerializer">The serializer to use.</param>
23-
public RoamingObjectStorageHelper(IObjectSerializer objectSerializer = null)
22+
public RoamingObjectStorageHelper(IObjectSerializer objectSerializer)
2423
: base(objectSerializer)
2524
{
2625
Settings = ApplicationData.Current.RoamingSettings;

0 commit comments

Comments
 (0)