Skip to content

Commit

Permalink
docs: Update README for release 4.0.0 (#405)
Browse files Browse the repository at this point in the history
  • Loading branch information
mtrezza authored Dec 24, 2024
1 parent 0055373 commit 9573619
Showing 1 changed file with 20 additions and 81 deletions.
101 changes: 20 additions & 81 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Parse SDK for .NET
![parse-repository-header-sdk-dotnet](https://github.com/user-attachments/assets/f4672e91-2b80-45a2-8619-7c9511e93d65)

---

Expand All @@ -17,33 +17,19 @@

---

A library that gives you access to the powerful Parse Server backend from any platform supporting .NET Standard 2.0. For more information about Parse and its features, visit [parseplatform.org](https://parseplatform.org/).
This library gives you access to the powerful Parse Server backend from your .NET app. For more information on Parse Platform and its features, visit [parseplatform.org](https://parseplatform.org).

---

- [Parse SDK for .NET](#parse-sdk-for-net)
- [Getting Started](#getting-started)
- [Compatibility](#compatibility)
- [.NET](#net)
- [Using the Code](#using-the-code)
- [Common Definitions](#common-definitions)
- [Client-Side Use](#client-side-use)
- [Use In Unity Client](#use-in-unity-client)
- [Unity3D on iOS](#unity3d-on-ios)
- [Unity3D on Android](#unity3d-on-android)
- [Server-Side Use](#server-side-use)
- [Basic Demonstration](#basic-demonstration)
- [Local Builds](#local-builds)
- [.NET Core CLI](#net-core-cli)


## Getting Started
The previous stable release version 1.7.0 is available as [a NuGet package][nuget-link].

The latest development release is also available as [a NuGet package (Prerelease)][nuget-link-prerelease].

Note that the previous stable package currently available on the official distribution channel is quite old.
To use the most up-to-date code, either build this project and reference the generated NuGet package, download the pre-built assembly from [releases][releases-link] or check the [NuGet package (Prerelease)][nuget-link-prerelease] on NuGet.
- [Compatibility](#compatibility)
- [.NET](#net)
- [Using the Code](#using-the-code)
- [Common Definitions](#common-definitions)
- [Client-Side Use](#client-side-use)
- [Server-Side Use](#server-side-use)
- [Basic Demonstration](#basic-demonstration)
- [Local Builds](#local-builds)
- [.NET Core CLI](#net-core-cli)

## Compatibility

Expand All @@ -53,10 +39,14 @@ Parse .NET SDK is continuously tested with the most recent releases of .NET to e

| .NET Version | End-of-Life | Parse .NET SDK Version |
|--------------|---------------|------------------------|
| 6.0 | November 2024 | >= 1.0 |
| 7.0 | May 2024 | >= 1.0 |
| 8.0 | November 2026 | >= 1.0 |
| 9.0 | May 2026 | >= 1.0 |
| Standard 2.0 | November 2024 | >=1.0.0 <4.0.0 |
| 6.0 | November 2024 | >=1.0.0 |
| 7.0 | May 2024 | >=1.0.0 |
| 8.0 | November 2026 | >=1.0.0 |
| 9.0 | May 2026 | >=1.0.0 |

> [!NOTE]
> We have removed support for [NET Standard 2.0](https://devblogs.microsoft.com/dotnet/the-future-of-net-standard/) with Parse .NET SDK 4.0. Xamarin developers should migrate to .NET MAUI to use the latest version of the Parse .NET SDK. Unity developers should use Parse .NET SDK <4.0 until Unity supports .NET and then migrate to the latest version of the Parse .NET SDK.
## Using the Code
Make sure you are using the project's root namespace.
Expand Down Expand Up @@ -87,8 +77,7 @@ ParseClient client = new ParseClient(new ServerConnectionData

`ServerConnectionData` is available in the `Parse.Infrastructure` namespace.

The two non-cloning `ParseClient` constructors contain optional parameters for an `IServiceHub` implementation instance and an array of `IServiceHubMutator`s. These should only be used when the behaviour of the SDK needs to be changed such as [when it is used with the Unity game engine](#use-in-unity-client).

The two non-cloning `ParseClient` constructors contain optional parameters for an `IServiceHub` implementation instance and an array of `IServiceHubMutator`s. These should only be used when the behavior of the SDK needs to be changed.

To find full usage instructions for the latest stable release, please visit the [Parse docs website][parse-docs-link]. Please note that the latest stable release is quite old and does not reflect the work being done at the moment.

Expand All @@ -111,56 +100,6 @@ In your program's entry point, instantiate a `ParseClient` with all the paramete
new ParseClient(/* Parameters */).Publicize();
```

### Use In Unity Client

In Unity, the same logic applies to use the SDK as in [any other client](#client-side-use), except that a special `IServiceHub` impelementation instance, a `MetadataMutator`, and an `AbsoluteCacheLocationMutator` need to be passed in to one of the non-cloning `ParseClient` constructors in order to specify the environment and platform metadata, as well as the absolute cache location manually. This step is needed because the logic that creates these values automatically will fail and create incorrect values. The functionality to do this automatically may eventually be provided as a Unity package in the future, but for now, the following code can be used.

```csharp
using System;
using UnityEngine;
using Parse.Infrastructure;
```

```csharp
new ParseClient(/* Parameters */,
new LateInitializedMutableServiceHub { },
new MetadataMutator
{
EnvironmentData = new EnvironmentData { OSVersion = SystemInfo.operatingSystem, Platform = $"Unity {Application.unityVersion} on {SystemInfo.operatingSystemFamily}", TimeZone = TimeZoneInfo.Local.StandardName },
HostManifestData = new HostManifestData { Name = Application.productName, Identifier = Application.productName, ShortVersion = Application.version, Version = Application.version }
},
new AbsoluteCacheLocationMutator
{
CustomAbsoluteCacheFilePath = $"{Application.persistentDataPath.Replace('/', Path.DirectorySeparatorChar)}{Path.DirectorySeparatorChar}Parse.cache"
}
).Publicize();
```

Other `IServiceHubMutator` implementations are available that do different things, such as the `RelativeCacheLocationMutator`, which allows a custom cache location relative to the default base folder (`System.Environment.SpecialFolder.LocalApplicationData`) to be specified.

If you are having trouble getting the SDK to work on other platforms, try to use the above code to control what values for various metadata information items the SDK will use, to see if that fixes the issue.

#### Unity3D on iOS

When using the Parse SDK on iOS/iPadOS target platforms you may encounter issues during runtime where the creation of ParseObjects using subclassing or other Parse methods fail. This occurs due to the fact that Unity strips code from the project and it will most likely do so for some parts of the Parse.dll assembly file.

To prevent Unity to remove necessary code from the assembly it is necessary to include a link.xml file in your project which tells Unity to not touch anything from the Parse.dll.

```xml
<linker>
<assembly fullname="Parse" preserve="all"/>
</linker>
```
Save the above xml code to a file called 'link.xml' and place it in the Assets folder of your project.

#### Unity3D on Android

When using the Parse SDK on Android target platform you may encounter an issue related to network communication and resolution of host addresses when using the Parse SDK. This occurs in situations where you might use the Parse SDK but did not configure your Android app to require internet access. Whenever a project does not explicitly state it requires internet access Unity will try to remove classes and system assemblies during the build process, causing Parse-calls to fail with different exceptions.
This may not be the case if your project uses any Unity specific web/networking code, as this will be detected by the engine and the code stripping will not be done.

To set your project, navigate to `Project Settings -> Player -> Other Settings -> Internet Access` and switch it to Require.
Depending on the version of Unity you are using this setting may be found in a slightly different location or with slightly different naming, use the above path as a guidance.

### Server-Side Use

The SDK can be set up in a way such that every new `ParseClient` instance can authenticate a different user concurrently. This is enabled by an `IServiceHubMutator` implementation which adds itself as an `IServiceHubCloner` implementation to the service hub which, making it so that consecutive calls to the cloning `ParseClient` constructor (the one without parameters) will clone the publicized `ParseClient` instance, exposed by `ParseClient.Instance`, replacing the `IParseCurrentUserController` implementation instance with a fresh one with no caching every time. This allows you to configure the original instance, and have the clones retain the general behaviour, while also allowing the differnt users to be signed into the their respective clones and execute requests concurrently, without causing race conditions. To use this feature of the SDK, the first `ParseClient` instance must be constructued and publicized as follows once, before any other `ParseClient` instantiations. Any classes that need to be registered must be done so with the original instance.
Expand Down

0 comments on commit 9573619

Please sign in to comment.