Skip to content

Commit b0bc80b

Browse files
Update docs around custom node instances to match latest API changes
1 parent 3bc35ae commit b0bc80b

File tree

1 file changed

+6
-5
lines changed
  • src/Microsoft.AspNetCore.NodeServices

1 file changed

+6
-5
lines changed

src/Microsoft.AspNetCore.NodeServices/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,12 @@ The default transport may change from `Http` to `Socket` in the near future, bec
349349

350350
### Custom hosting models
351351

352-
If you implement a custom hosting model (by implementing `INodeServices`), then you can get instances of that just by using your type's constructor. Or if you want to designate it as the default hosting model that higher-level services (such as those in the `SpaServices` package) should use, register it with ASP.NET Core's DI system:
352+
If you implement a custom hosting model (by implementing `INodeInstance`), then you can cause it to be used by populating `NodeInstanceFactory` on a `NodeServicesOptions`:
353353

354354
```csharp
355-
services.AddSingleton(typeof(INodeServices), serviceProvider =>
356-
{
357-
return new YourCustomHostingModel();
358-
});
355+
var options = new NodeServicesOptions {
356+
NodeInstanceFactory = () => new MyCustomNodeInstance()
357+
};
359358
```
359+
360+
Now you can pass this `options` object to [`AddNodeServices`](#addnodeservices) or [`CreateNodeServices`](#createnodeservices).

0 commit comments

Comments
 (0)