You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 8, 2020. It is now read-only.
Copy file name to clipboardExpand all lines: src/Microsoft.AspNetCore.NodeServices/README.md
+4-11Lines changed: 4 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,15 +43,9 @@ In that case, you don't need to use NodeServices directly (or install it manuall
43
43
44
44
## For ASP.NET Core apps
45
45
46
-
ASP.NET Core has a built-in dependency injection (DI) system. NodeServices is designed to work with this, so you don't have to manage the creation or disposal of instances.
46
+
.NET Core has a built-in dependency injection (DI) system. NodeServices is designed to work with this, so you don't have to manage the creation or disposal of instances.
47
47
48
-
Enable NodeServices in your application by first adding the following to the top of your `Startup.cs` file:
49
-
50
-
```csharp
51
-
usingMicrosoft.AspNetCore.NodeServices;
52
-
```
53
-
54
-
... and then add to your `ConfigureServices` method in that file:
48
+
Enable NodeServices in your application by first adding the following to your `ConfigureServices` method in `Startup.cs`:
@@ -93,7 +87,6 @@ If you want to put `addNumber.js` inside a subfolder rather than the root of you
93
87
In other types of .NET Core app, where you don't have ASP.NET supplying an `IServiceCollection` to you, you'll need to instantiate your own DI container. For example, add a reference to the .NET package `Microsoft.Extensions.DependencyInjection`, and then you can construct an `IServiceCollection`, then register NodeServices as usual:
94
88
95
89
```csharp
96
-
// Remember to add 'using Microsoft.AspNetCore.NodeServices;' at the top of your file
97
90
varservices=newServiceCollection();
98
91
services.AddNodeServices(options=> {
99
92
// Set any properties that you want on 'options' here
This is an extension method on `IServiceCollection`. It registers NodeServices with ASP.NET Core's DI system. Typically you should call this from the `ConfigureServices` method in your `Startup.cs` file.
135
128
136
-
To access this extension method, you'll need to add the following namespace import to the top of your file:
129
+
To access this extension method, you'll need to add the following namespace import to the top of your file, if it isn't already there:
0 commit comments