Orleans.Providers.Neo4j 1.0.1

dotnet add package Orleans.Providers.Neo4j --version 1.0.1
NuGet\Install-Package Orleans.Providers.Neo4j -Version 1.0.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="Orleans.Providers.Neo4j" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Orleans.Providers.Neo4j --version 1.0.1
#r "nuget: Orleans.Providers.Neo4j, 1.0.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.
// Install Orleans.Providers.Neo4j as a Cake Addin
#addin nuget:?package=Orleans.Providers.Neo4j&version=1.0.1

// Install Orleans.Providers.Neo4j as a Cake Tool
#tool nuget:?package=Orleans.Providers.Neo4j&version=1.0.1

Orleans.Providers.Neo4j

A Neo4j implementation of the Orleans Providers.

This includes:

  • Membership (Planned)
  • Reminders (Planned)
  • Storage (Beta)

Storage

There are two storage options included in this provider. The first is simple an unobtrusive, the entire state object is serialized as JSON and stored inside the state property of the node.

For example:

public class MyState
{
	public string Name { get; set; }
	public int Age { get; set; }
}

Will be stored as a JSON string on the node as:

"state" : "{ \"Name\": \"John\", \"Age\": 42 }",
"eTag" : "FC14312382"

The second is complex, but allows for more querying the state. Every state object is flattened out into a dictionary by creating a INeo4jStateConverter for the specified state type.

For example:

public class MyState
{
	public string Name { get; set; }
	public int Age { get; set; }
}

public class MyStateConverter : INeo4jStateConverter<MyState>
{
	public Dictionary<string, object> ConvertFrom(MyState state)
	{
		return new Dictionary<string, object>
		{
			{ "Name", state.Name },
			{ "Age", state.Age }
		};
	}

	public MyState ConvertTo(Dictionary<string, object> dictionary)
	{
		return new MyState
		{
			Name = dictionary["Name"].ToString(),
			Age = int.Parse(dictionary["Age"].ToString())
		};
	}
}

This will be stored on the node as:

"name" : "John",
"age" : 42,
"eTag" : "FC14312382"

Options and Configuration

The options class is Neo4jGrainStorageOptions.

It lists the following options:

  • Uri - The URI for the neo4j host.
  • Database - The database to use. Defaults to neo4j.
  • Username - The username to use when connecting to the database. Defaults to neo4j.
  • Password - The password to use when connecting to the database. Defaults to neo4j.
  • StatePropertyName - The name of the property to store the state on. Defaults to state.
  • ETagPropertyName - The name of the property to store the eTag on. Defaults to eTag.
  • JsonSerializerOptions - Override the default JsonSerializerOptions options.
  • KeyGenerator - Override how Keys/ID's are generated.
  • ETagGenerator - Override how eTags are generated.
  • StorageClient - Override the Storage Client with your own implementation.
  • StateConverters - Manually wire up custom state converters. By default they are discovered at runtime.

Setup:

Simply add AddNeo4jGrainStorage or AddNeo4jGrainStorageAsDefault on your builder configuration.

builder.AddNeo4jGrainStorageAsDefault(storageOptions =>
{
    storageOptions.Uri = "127.0.0.1";
    storageOptions.Database = "neo4j";
    storageOptions.Username = "neo4j";
    storageOptions.Password = "Password1";
})
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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 was computed.  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. 
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
1.0.1 116 10/10/2023
1.0.0 105 10/10/2023