Microsoft.Orleans.Serialization.FSharp 9.2.1

Prefix Reserved
dotnet add package Microsoft.Orleans.Serialization.FSharp --version 9.2.1
                    
NuGet\Install-Package Microsoft.Orleans.Serialization.FSharp -Version 9.2.1
                    
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.1" />
                    
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.1" />
                    
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.1
                    
#r "nuget: Microsoft.Orleans.Serialization.FSharp, 9.2.1"
                    
#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.1
                    
#: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.1
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Serialization.FSharp&version=9.2.1
                    
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 527 7/16/2025
9.2.0 209 7/14/2025
9.2.0-preview3 2,146 6/10/2025
9.2.0-preview2 601 6/4/2025
9.2.0-preview1 1,128 4/4/2025
9.1.2 3,203 2/13/2025
9.0.1 1,290 11/23/2024
9.0.0 646 11/14/2024
8.2.0 15,883 7/12/2024
8.2.0-preview1 140 5/22/2024
8.1.0 1,849 4/17/2024
8.1.0-preview3 223 3/11/2024
8.1.0-preview2 272 2/23/2024
8.1.0-preview1 275 2/13/2024
8.0.0 2,562 1/5/2024
8.0.0-rc2 508 12/20/2023
8.0.0-rc1 501 12/4/2023
7.2.7 165 10/15/2024
7.2.6 1,422 3/9/2024
7.2.5 337 2/22/2024
7.2.4 13,281 12/2/2023
7.2.3 1,072 11/3/2023
7.2.2 607 10/16/2023
7.2.1 10,175 7/11/2023
7.2.0 738 7/7/2023
7.1.2 802 4/19/2023
7.1.1 849 3/23/2023
7.1.0 919 2/1/2023
7.0.0 18,608 11/8/2022
7.0.0-rc2 685 10/19/2022
4.0.0-preview2 750 8/4/2022
4.0.0-preview1 757 2/10/2022