diff --git a/src/ReactiveElmish.Avalonia/CompositionRoot.fs b/src/ReactiveElmish.Avalonia/CompositionRoot.fs
index 940faa4..e7200af 100644
--- a/src/ReactiveElmish.Avalonia/CompositionRoot.fs
+++ b/src/ReactiveElmish.Avalonia/CompositionRoot.fs
@@ -76,12 +76,12 @@ type CompositionRoot() as this =
| None ->
failwithf $"No view registered for VM type {vmType.FullName}"
- ///Check to see if a view has been registered for the given view model
+ /// Check to see if a view has been registered for the given view model.
member this.HasViewFor(vm: 'ViewModel & #ReactiveElmishViewModel) =
let vmType = vm.GetType()
viewRegistry.Value |> Map.tryFind(VM.Key vmType) |> Option.isSome
- ///Gets or creates a view for a given view model instance and binds it
+ /// Gets or creates a view for a given view model instance and binds it.
member this.GetViewFor(vm: 'ViewModel & #ReactiveElmishViewModel) =
let vmType = vm.GetType()
match viewRegistry.Value |> Map.tryFind (VM.Key vmType) with
diff --git a/src/ReactiveElmish.Avalonia/ReactiveElmish.Avalonia.fsproj b/src/ReactiveElmish.Avalonia/ReactiveElmish.Avalonia.fsproj
index 5f7456b..acad454 100644
--- a/src/ReactiveElmish.Avalonia/ReactiveElmish.Avalonia.fsproj
+++ b/src/ReactiveElmish.Avalonia/ReactiveElmish.Avalonia.fsproj
@@ -17,7 +17,7 @@
MIT
https://github.com/JordanMarr/ReactiveElmish.Avalonia
Avalonia F# fsharp Elmish Elm
- 1.2.0
+ 1.2.1
$(OtherFlags) --warnon:1182
$(TargetsForTfmSpecificBuildOutput);CopyProjectReferencesToPackage
diff --git a/src/Samples/AvaloniaExample/App.axaml.fs b/src/Samples/AvaloniaExample/App.axaml.fs
index cf61969..fe188eb 100644
--- a/src/Samples/AvaloniaExample/App.axaml.fs
+++ b/src/Samples/AvaloniaExample/App.axaml.fs
@@ -17,7 +17,7 @@ type App() =
override this.OnFrameworkInitializationCompleted() =
match this.ApplicationLifetime with
| :? IClassicDesktopStyleApplicationLifetime as desktop ->
- let appRoot = Root.Current
+ let appRoot = AppCompositionRoot.Instance
desktop.MainWindow <- appRoot.GetView() :?> Window
| _ ->
// leave this here for design view re-renders
diff --git a/src/Samples/AvaloniaExample/AppCompositionRoot.fs b/src/Samples/AvaloniaExample/AppCompositionRoot.fs
index c566719..70d0000 100644
--- a/src/Samples/AvaloniaExample/AppCompositionRoot.fs
+++ b/src/Samples/AvaloniaExample/AppCompositionRoot.fs
@@ -23,8 +23,8 @@ type AppCompositionRoot() =
VM.Key(), View.Singleton()
VM.Key(), View.Singleton()
]
+
+ static member private instanceLazy = lazy AppCompositionRoot()
+ static member Instance = AppCompositionRoot.instanceLazy.Value
-module Root =
- let private current = lazy AppCompositionRoot()
- let public Current = current.Value
diff --git a/src/Samples/AvaloniaExample/ViewLocator.fs b/src/Samples/AvaloniaExample/ViewLocator.fs
index 000fd61..ad83252 100644
--- a/src/Samples/AvaloniaExample/ViewLocator.fs
+++ b/src/Samples/AvaloniaExample/ViewLocator.fs
@@ -12,7 +12,7 @@ type ViewLocator() =
member this.Build(data) =
match data with
- | :? ReactiveElmishViewModel as reactiveViewModel -> Root.Current.GetViewFor(reactiveViewModel)
+ | :? ReactiveElmishViewModel as reactiveViewModel -> AppCompositionRoot.Instance.GetViewFor(reactiveViewModel)
| _ ->
let t = data.GetType()
let viewName = t.FullName.Replace("ViewModels", "Views").Replace("ViewModel", "View")
@@ -34,7 +34,7 @@ type ViewLocator() =
member this.Match(data) =
match data with
- | :? ReactiveElmishViewModel as reactiveViewModel -> Root.Current.HasViewFor(reactiveViewModel)
+ | :? ReactiveElmishViewModel as vm -> AppCompositionRoot.Instance.HasViewFor(vm)
| :? ReactiveUI.ReactiveObject -> true
| _ -> false