<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dapr Actors (Next) in the .NET SDK on Dapr Docs</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/</link><description>Recent content in Dapr Actors (Next) in the .NET SDK on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/index.xml" rel="self" type="application/rss+xml"/><item><title>Migrating from Dapr.Actors to Dapr.Actors.Next</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-migration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-migration/</guid><description>&lt;p>This guide is for developers who already run actors on &lt;code>Dapr.Actors&lt;/code> (typically hosted with &lt;code>Dapr.Actors.AspNetCore&lt;/code>) and want to move to &lt;code>Dapr.Actors.Next&lt;/code>. It walks each concept you use today, shows the equivalent in the new SDK, explains how the concept itself changed, calls out those opportunities to make impactful mistakes, and gives before/after code. This document assumes you know how &lt;code>Dapr.Actors&lt;/code> works; it does not re-teach the actor model, and it deliberately skips features that have no analog in the old SDK (state machines, subscription streams, the in-memory test runtime, and state migration each have their own page).&lt;/p></description></item><item><title>How to: Author, register, and call actors with the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-howto/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-howto/</guid><description>&lt;p>This article shows how to define an actor, what attributes drive the source generator, the minimum you must register, and how to call actors, including cross-assembly and cross-app scenarios.&lt;/p>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;p>Dapr runtime v1.18.0 or later, a port on your application for gRPC inbound connections, and the &lt;code>Dapr.Actors.Next&lt;/code> package. &lt;code>Dapr.Actors.Next&lt;/code> is a meta-package that brings the runtime, source generators, and analyzers in one reference.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">&amp;lt;ItemGroup&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#204a87;font-weight:bold">&amp;lt;PackageReference&lt;/span> &lt;span style="color:#c4a000">Include=&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;Dapr.Actors.Next&amp;#34;&lt;/span> &lt;span style="color:#c4a000">Version=&lt;/span>&lt;span style="color:#4e9a06">&amp;#34;...&amp;#34;&lt;/span> &lt;span style="color:#204a87;font-weight:bold">/&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">&amp;lt;/ItemGroup&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>

&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">No actor endpoints to map&lt;/h4>

 Unlike &lt;code>Dapr.Actors&lt;/code>, you do not map actor handler endpoints for the runtime to call into per invocation. The host opens a persistent gRPC connection to the runtime and receives actor callbacks over that stream, so there is nothing like &lt;code>MapActorsHandlers()&lt;/code> to wire up. The application still exposes its gRPC server port as usual; the runtime continues to use it for its gRPC precondition checks. What changes is how actor callbacks are delivered, not whether the app runs a gRPC server.

&lt;/div>



&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">Package references&lt;/h4>

 All projects within the Dapr .NET SDK repository are referenced using relative paths. As meta-packages like &lt;code>Dapr.Workflows&lt;/code> or &lt;code>Dapr.Actors.Next&lt;/code> are only an artifact of the build pipeline, the individual projects in the source code refernce each of the individual projects within the repository (e.g. &lt;code>Dapr.Actors.Next.SourceGenerators&lt;/code> or &lt;code>Dapr.Actors.Next.Abstractions&lt;/code>). These packages are not intended to be published to NuGet and only for local SDK experimentation and development. When using this package in your own projects, whether host or test projects, it is intended that you install &lt;code>Dapr.Actors.Next&lt;/code> from NuGet.

&lt;/div>

&lt;h2 id="define-an-actor">Define an actor&lt;/h2>
&lt;p>An actor has two parts: a contract interface that derives from &lt;code>IActor&lt;/code> and is decorated with &lt;code>[GenerateActorClient]&lt;/code>, and an implementation that derives from &lt;code>Actor&lt;/code> and is decorated with &lt;code>[DaprActor]&lt;/code>.&lt;/p></description></item><item><title>Serialization in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-serialization/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-serialization/</guid><description>&lt;p>&lt;code>Dapr.Actors.Next&lt;/code> uses the same pluggable serializer as Dapr State management and Workflows, works with modern C# types out of the box, and retains the per-actor state cache. This page covers those. Evolving state shapes across releases is a separate, deeper topic with its own page: see &lt;a href="https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-statemigration/">State migration&lt;/a>.&lt;/p>
&lt;h2 id="pluggable-serialization">Pluggable serialization&lt;/h2>
&lt;p>Actor payloads and state are serialized through &lt;code>IDaprSerializer&lt;/code>, resolved from dependency injection. The default implementation is &lt;code>JsonDaprSerializer&lt;/code> (System.Text.Json), and you can replace it without changing any actor code.&lt;/p></description></item><item><title>State migration in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-statemigration/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-statemigration/</guid><description>&lt;p>Actors have no replay, so they have no code-versioning problem: a new deployment simply is the new behavior. The only thing that must survive a deploy is the actor&amp;rsquo;s persisted state, so migration here means one specific thing, keeping state written under an older shape loadable and usable under newer code. It is deserialization compatibility on read, not a workflow-style code-version system.&lt;/p>
&lt;p>The feature is opt-in by default. If a state type&amp;rsquo;s shape does not change, there is nothing to migrate and no machinery to configure; the type behaves exactly as it does today. You enroll a type in migration only by authoring an upcaster that touches it, or by letting the generator synthesize a trivial additive upcaster.&lt;/p></description></item><item><title>State machine actors in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-statemachine/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-statemachine/</guid><description>&lt;p>Some actors are genuinely state machines: a connection, a device, an auction, a subscription, a lease. Each is a long-lived, addressable entity that reacts to events and moves through explicit states over an indefinite lifetime. &lt;code>Dapr.Actors.Next&lt;/code> provides a first-class model for these, &lt;code>StateMachineActor&amp;lt;TState, TData&amp;gt;&lt;/code>, that stays an ordinary strongly-typed Dapr actor on the outside while letting you author the behavior as an explicit state machine on the inside.&lt;/p>
&lt;h2 id="when-to-use-a-state-machine-actor">When to use a state machine actor&lt;/h2>
&lt;p>Reach for this model when an actor has a small number of distinct states and the rules for what it may do depend on which state it is in. Encoding those states and transitions explicitly makes the rules visible, keeps illegal transitions from happening by accident, and (because the machine is a table rather than scattered &lt;code>if&lt;/code> statements) lets the test runtime check the structure for you.&lt;/p></description></item><item><title>Subscription streams in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-streams/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-streams/</guid><description>&lt;p>Subscription streams let an actor react to messages from an existing Dapr pub/sub component. You annotate an actor method with &lt;code>[Subscribe]&lt;/code>, and a delivered topic event wakes the actor and invokes that method, much like a timer or reminder firing.&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">Package&lt;/h4>

 Subscription streams ship in the &lt;code>Dapr.Actors.Next.Streams&lt;/code> namespace, included in the &lt;code>Dapr.Actors.Next&lt;/code> meta-package. It uses Dapr pub/sub and actor invocation as they exist today, so it works against the current runtime with no runtime changes.

&lt;/div>

&lt;h2 id="how-it-works">How it works&lt;/h2>
&lt;p>The subscription lives at the host, not in the actor body. The package opens a streaming subscription to the topic, receives filtered events, and forwards each one to the target actor as a normal, placement-routed proxy invocation. That invocation is what wakes the actor, wherever placement has put it, and runs it turn-based with all the usual guarantees.&lt;/p></description></item><item><title>Dynamic actor invocation in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-dynamic/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-dynamic/</guid><description>&lt;p>Most application code calls actors through the strongly-typed proxy, which needs the actor&amp;rsquo;s contract interface at compile time. Dynamic invocation is the other path: call an actor by its type name, id, and method with a serialized payload, without a compile-time contract. This is the actor protocol itself rather than a .NET authoring feature, which is what makes it the language-agnostic way to call actors and a distinctly different capability from the rest of the SDK.&lt;/p></description></item><item><title>Testing actors in the .NET SDK</title><link>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-testing/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/dotnet/dotnet-actors-next/dotnet-actorsnext-testing/</guid><description>&lt;p>Testing is the headline capability of &lt;code>Dapr.Actors.Next&lt;/code>. The hard parts of actors, including reentrancy, a timer that comes due while a call is in progress, duplicate or out-of-order delivery, and a failure in the middle of a state write, are normally only reachable with a running sidecar and wall-clock timing, which makes them effectively untestable. This SDK makes them deterministic, fast, and reproducible by isolating the three sources of nondeterminism (transport, scheduling, and time) behind abstractions, so the same actor code runs against either the real runtime or an in-memory test runtime.&lt;/p></description></item></channel></rss>