How to integrate Sanity with a .NET middleware
Is there anything in particular you are having problems with?
//sanity
var options = new SanityOptions
{
ProjectId = builder.Configuration.GetSection("Sanity")["ProjectId"],
Dataset = builder.Configuration.GetSection("Sanity")["Dataset"],
Token = builder.Configuration.GetSection("Sanity")["Token"],
UseCdn = false,
ApiVersion = "v1"
};
var sanityDataContext = new SanityDataContext(options);
builder.Services.AddSingleton(sanityDataContext);using Sanity.Linq;
using MainAPI.Sanity;
Was this answer helpful?
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.