Skip to content

Commit 0ea3e6e

Browse files
authored
docs(readme): fix MS DI setup example (#50)
1 parent 2901100 commit 0ea3e6e

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

README.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,12 @@ public static AppBuilder BuildAvaloniaApp() => AppBuilder
115115
withResolver: sp =>
116116
{
117117
// Optional: access ServiceProvider
118-
},
119-
withReactiveUIBuilder: rxui =>
120-
{
121-
// Optional ReactiveUI customizations
122118
})
123-
.RegisterReactiveUIViewsFromEntryAssembly();
119+
;
124120
```
125121

122+
Note: `UseReactiveUIWithMicrosoftDependencyResolver(...)` builds the `ServiceProvider` during setup, so make sure you register all services (including any `IViewFor<T>` views) in the `services => { ... }` callback.
123+
126124
With Ninject:
127125

128126
```csharp
@@ -149,7 +147,7 @@ Notes
149147
---
150148
## Manual setup (without container mixins)
151149

152-
You can configure a custom container using the generic `UseReactiveUIWithDIContainer` if you don’t use one of the provided integrations:
150+
You can configure a custom container using the generic `UseReactiveUIWithDIContainer` if you don’t use one of the provided integrations:
153151

154152
```csharp
155153
AppBuilder
@@ -222,12 +220,12 @@ public partial class MainView : ReactiveUserControl<MyViewModel>
222220
### ReactiveUI.Avalonia (core)
223221

224222
Key extension methods on `AppBuilder`:
225-
- `UseReactiveUI()` — initialize ReactiveUI for Avalonia (scheduler, activation, bindings)
226-
- `UseReactiveUI(Action<ReactiveUIBuilder>)` — initialize with the `ReactiveUIBuilder` for additional configuration
227-
- `RegisterReactiveUIViews(params Assembly[])` — scan and register views implementing `IViewFor<T>`
228-
- `RegisterReactiveUIViewsFromEntryAssembly()` — convenience overload to scan the entry assembly
229-
- `RegisterReactiveUIViewsFromAssemblyOf<TMarker>()` — scan a specific assembly
230-
- `UseReactiveUIWithDIContainer<TContainer>(...)` — bring-your-own container integration via an `IDependencyResolver`
223+
- `UseReactiveUI()` — initialize ReactiveUI for Avalonia (scheduler, activation, bindings)
224+
- `UseReactiveUI(Action<ReactiveUIBuilder>)` — initialize with the `ReactiveUIBuilder` for additional configuration
225+
- `RegisterReactiveUIViews(params Assembly[])` — scan and register views implementing `IViewFor<T>`
226+
- `RegisterReactiveUIViewsFromEntryAssembly()` — convenience overload to scan the entry assembly
227+
- `RegisterReactiveUIViewsFromAssemblyOf<TMarker>()` — scan a specific assembly
228+
- `UseReactiveUIWithDIContainer<TContainer>(...)` — bring-your-own container integration via an `IDependencyResolver`
231229

232230
Important types registered by default:
233231
- `IActivationForViewFetcher` ? `AvaloniaActivationForViewFetcher`
@@ -237,8 +235,8 @@ Important types registered by default:
237235
- `RxApp.MainThreadScheduler` set to `AvaloniaScheduler.Instance`
238236

239237
Controls and helpers:
240-
- `RoutedViewHost` — view host that displays the view for the current `RoutingState`
241-
- `ReactiveUserControl<TViewModel>`, `ReactiveWindow<TViewModel>` — base classes for reactive views
238+
- `RoutedViewHost` — view host that displays the view for the current `RoutingState`
239+
- `ReactiveUserControl<TViewModel>`, `ReactiveWindow<TViewModel>` — base classes for reactive views
242240

243241
### ReactiveUI.Avalonia.Autofac
244242

0 commit comments

Comments
 (0)