Dapr (state store) integration results in compiler warning with no obvious way to fix it #16375
Answered
by
Artpupser
Mark Parker (godefroi)
asked this question in
Q&A
|
In the Dapr integration documentation for state stores, the following code is suggested: When I add this to my AppHost, however, I get this warning: .. but I don't know how I can do that; how would I even get a reference to the "sidecar resource"? |
Answered by
Artpupser
Apr 25, 2026
Replies: 1 comment 1 reply
|
The new API expects you to move the var stateStore = builder.AddDaprStateStore("statestore");
builder.AddProject<Projects.ExampleProject>("exampleproject")
.WithDaprSidecar(sidecar =>
{
sidecar.WithReference(stateStore);
});The If you need to configure sidecar options at the same time: builder.AddProject<Projects.ExampleProject>("exampleproject")
.WithDaprSidecar(sidecar =>
{
sidecar.WithOptions(new DaprSidecarOptions { AppId = "exampleproject" })
.WithReference(stateStore);
}); |
1 reply
Answer selected by
godefroi
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Mark Parker (@godefroi),
The new API expects you to move the
WithReferencecall inside theWithDaprSidecarcallback, so the reference is added to the sidecar resource rather than the project resource:The
WithDaprSidecaroverload that takes anAction<IResourceBuilder<IDaprSidecarResource>>callback gives you a builder scoped to the sidecar resource itself, andWithReferenceon that builder is the non-obsolete path.If you need to configure sidecar options at the same …