Migrating from other adapters

Map an InertiaCore-style API to Inertia.Net and check the behavior differences.

The API is close to the Laravel adapter's names. The table maps the typical InertiaCore-style API (kapi2289/InertiaCore and its forks). Check names against the version you use.

Other adaptersInertia.Net
Inertia.Render("Users/Index", new { users })Render("Users/Index", new InertiaProps { ["users"] = users }), or a typed props object
return Inertia.Render(...) in a controller (Task<IActionResult>)return Render(...) as IResult (MVC executes it)
Inertia.Lazy(() => ...) / LazyPropOptional(() => ...) (never on first load) or Prop(() => ...) (lazy, included by default)
Inertia.Defer(...) / Inertia.Defer(..., "group")Defer(..., group: "group")
Inertia.Always(...)Always(...)
Inertia.Merge(...) / DeepMergeMerge(...), DeepMerge(...), plus .Prepend(), .MatchOn()
(not supported)Once(...), Scroll(...), .Rescue(), .Parallel(), .Cache(key, duration)
Inertia.Share("key", value)o.Share("key", value), o.Share("key", ctx => ...), or ctx.Inertia().Share(...)
Inertia.Location(url)Location(url)
Inertia.Back()Back() / Back(fallback)
Inertia.ClearHistory(), Inertia.EncryptHistory()ctx.Inertia().ClearHistory(), ctx.Inertia().EncryptHistory() (per request, no shared state)
Inertia.Html(...) / Inertia.Head in _Layout.cshtmlapp.html with @inertia, @inertiaHead, @vite(...), or the Razor tag helpers
Flash via TempData or sessionctx.Inertia().Flash(...), Back().WithFlash(...) (encrypted cookie by default)
ModelState errors in sessionMVC: AddInertiaMvc(); Minimal API: .WithInertiaValidation(); FastEndpoints: c.UseInertia()
Version option or manifest hashing per requesto.Version, o.VersionResolver, or the cached manifest hash
SSR options (UseSsr, SsrUrl)o.Ssr.Mode, o.Ssr.Urls, o.Ssr.ExcludePaths, Render(...).WithSsr(...)

Behavior differences to check

  • v3 only. There is no v2 client support. Upgrade the client packages to v3. The first page is the <script data-page="app"> element, not a data-page attribute on the root div.
  • Props are resolved without reflection. Anonymous types need reflection-enabled serialization, and AOT apps register a JsonSerializerContext.
  • HTTP JSON options. Props serialize with the HTTP JSON options (camelCase by default), not Newtonsoft.
  • Version check before the handler. A stale client gets a 409 before your endpoint runs.
  • State is an encrypted cookie by default. Flash, errors and history flags use it unless you opt into the session store.

Upgrading Inertia.Net

Package upgrade notes live in the repository:

Use the same version

Update all Inertia.Net packages together. Mixing 1.5 with 1.4 packages can compile but produce different protocol output.