Microsoft.Orleans.Serialization.FSharp 9.2.0-preview2

Prefix Reserved
This is a prerelease version of Microsoft.Orleans.Serialization.FSharp.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Orleans.Serialization.FSharp --version 9.2.0-preview2
                    
NuGet\Install-Package Microsoft.Orleans.Serialization.FSharp -Version 9.2.0-preview2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Orleans.Serialization.FSharp" Version="9.2.0-preview2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Orleans.Serialization.FSharp" Version="9.2.0-preview2" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Serialization.FSharp" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Orleans.Serialization.FSharp --version 9.2.0-preview2
                    
#r "nuget: Microsoft.Orleans.Serialization.FSharp, 9.2.0-preview2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Orleans.Serialization.FSharp@9.2.0-preview2
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Orleans.Serialization.FSharp&version=9.2.0-preview2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Serialization.FSharp&version=9.2.0-preview2&prerelease
                    
Install as a Cake Tool

Microsoft Orleans Serialization for F#

Introduction

Microsoft Orleans Serialization for F# provides serialization support for F# specific types in Microsoft Orleans. This package enables seamless integration of F# types like discriminated unions, records, and other F# specific constructs with Orleans serialization system.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Serialization.FSharp

Example - Configuring F# Serialization

open Microsoft.Extensions.Hosting
open Orleans.Hosting

let builder = 
    Host.CreateApplicationBuilder(args)
        .UseOrleans(fun siloBuilder ->
            siloBuilder
                .UseLocalhostClustering()
                // F# serialization is automatically configured when the package is referenced
                |> ignore)

// Run the host
await builder.RunAsync()

Example - Using F# Types with Orleans

// Define F# discriminated union and record types
[<Orleans.GenerateSerializer>]
type UserRole =
    | [<Id(0u)>] Admin
    | [<Id(1u)>] Moderator
    | [<Id(2u)>] User of level:int

[<Orleans.GenerateSerializer>]
type UserRecord = {
    [<Id(0u)>] Id: string
    [<Id(1u)>] Name: string
    [<Id(2u)>] Role: UserRole
    [<Id(3u)>] Tags: string list
}

// Define a grain interface
type IFSharpGrain =
    inherit Orleans.IGrainWithStringKey
    abstract member GetUser: unit -> Task<UserRecord>
    abstract member UpdateUser: UserRecord -> Task

// Grain implementation
type FSharpGrain() =
    inherit Orleans.Grain()
    let mutable userData = Unchecked.defaultof<UserRecord>

    interface IFSharpGrain with
        member this.GetUser() =
            Task.FromResult(userData)
            
        member this.UpdateUser(user) =
            userData <- user
            Task.CompletedTask

Example - Client Code Using F# Grain

// Client-side code
let client = clientBuilder.Build()
let grain = client.GetGrain<IFSharpGrain>("user1")

// Create an F# record with discriminated union
let user = {
    Id = "user1"
    Name = "F# User"
    Role = UserRole.Admin
    Tags = ["functional"; "programming"]
}

// Call the grain with F# types
grain.UpdateUser(user) |> Async.AwaitTask |> ignore
let retrievedUser = grain.GetUser() |> Async.AwaitTask |> Async.RunSynchronously

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.2.1 246 7/16/2025
9.2.0 201 7/14/2025
9.2.0-preview3 1,631 6/10/2025
9.2.0-preview2 597 6/4/2025
9.2.0-preview1 950 4/4/2025
9.1.2 2,936 2/13/2025
9.0.1 1,284 11/23/2024
9.0.0 640 11/14/2024
8.2.0 15,874 7/12/2024
8.2.0-preview1 136 5/22/2024
8.1.0 1,843 4/17/2024
8.1.0-preview3 219 3/11/2024
8.1.0-preview2 268 2/23/2024
8.1.0-preview1 271 2/13/2024
8.0.0 2,556 1/5/2024
8.0.0-rc2 504 12/20/2023
8.0.0-rc1 497 12/4/2023
7.2.7 159 10/15/2024
7.2.6 1,416 3/9/2024
7.2.5 331 2/22/2024
7.2.4 13,277 12/2/2023
7.2.3 1,068 11/3/2023
7.2.2 603 10/16/2023
7.2.1 10,169 7/11/2023
7.2.0 732 7/7/2023
7.1.2 796 4/19/2023
7.1.1 843 3/23/2023
7.1.0 913 2/1/2023
7.0.0 18,602 11/8/2022
7.0.0-rc2 679 10/19/2022
4.0.0-preview2 744 8/4/2022
4.0.0-preview1 751 2/10/2022