Update docs around custom node instances to match latest API changes
This commit is contained in:
parent
3bc35aea21
commit
b0bc80b4d6
|
|
@ -349,11 +349,12 @@ The default transport may change from `Http` to `Socket` in the near future, bec
|
||||||
|
|
||||||
### Custom hosting models
|
### Custom hosting models
|
||||||
|
|
||||||
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:
|
If you implement a custom hosting model (by implementing `INodeInstance`), then you can cause it to be used by populating `NodeInstanceFactory` on a `NodeServicesOptions`:
|
||||||
|
|
||||||
```csharp
|
```csharp
|
||||||
services.AddSingleton(typeof(INodeServices), serviceProvider =>
|
var options = new NodeServicesOptions {
|
||||||
{
|
NodeInstanceFactory = () => new MyCustomNodeInstance()
|
||||||
return new YourCustomHostingModel();
|
};
|
||||||
});
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Now you can pass this `options` object to [`AddNodeServices`](#addnodeservices) or [`CreateNodeServices`](#createnodeservices).
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue