Skip to content
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ The class must inherit from a UI Control from any of the following platforms and

### IViewFor with Splat Registration Type

Choose from the following Splat Registration Types:
Choose from the following Splat Registration Types, option for IViewFor Registration and / or ViewModel Registration:
- `SplatRegistrationType.PerRequest`
- `SplatRegistrationType.LazySingleton`
- `SplatRegistrationType.Constant`
Expand All @@ -569,7 +569,7 @@ Choose from the following Splat Registration Types:
```csharp
using ReactiveUI.SourceGenerators;
using Splat;
[IViewFor<MyReactiveClass>(RegistrationType = SplatRegistrationType.PerRequest)]
[IViewFor<MyReactiveClass>(RegistrationType = SplatRegistrationType.PerRequest, ViewModelRegistrationType = SplatRegistrationType.LazySingleton)]
public partial class MyReactiveControl : UserControl
{
public MyReactiveControl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,16 @@ namespace ReactiveUI.SourceGenerators;
internal sealed class IViewForAttribute<T> : global::System.Attribute
{
/// <summary>
/// Gets the Splat registration type for Splat registration.
/// Gets the Splat registration type for Splat IViewFor registration.
/// Registers IViewFor<T> in the Splat service locator.
/// </summary>
public SplatRegistrationType RegistrationType { get; init; } = SplatRegistrationType.None;

/// <summary>
/// Gets the Splat registration type for Splat View Model registration.
/// Registers the ViewModel (T) in the Splat service locator.
/// </summary>
public SplatRegistrationType ViewModelRegistrationType { get; init; } = SplatRegistrationType.None;
}

/// <summary>
Expand All @@ -39,10 +45,16 @@ internal sealed class IViewForAttribute<T> : global::System.Attribute
internal sealed class IViewForAttribute(string? viewModelType) : global::System.Attribute
{
/// <summary>
/// Gets the Splat registration type for Splat registration.
/// Gets the Splat registration type for Splat IViewFor registration.
/// Registers IViewFor<T> in the Splat service locator.
/// </summary>
public SplatRegistrationType RegistrationType { get; init; } = SplatRegistrationType.None;

/// <summary>
/// Gets the Splat registration type for Splat View Model registration.
/// Registers the ViewModel (T) in the Splat service locator.
/// </summary>
public SplatRegistrationType ViewModelRegistrationType { get; init; } = SplatRegistrationType.None;
}
#nullable restore
#pragma warning restore
6 changes: 2 additions & 4 deletions src/ReactiveUI.SourceGenerator.Tests/TestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,17 @@ namespace ReactiveUI.SourceGenerator.Tests;
public sealed class TestHelper<T> : IDisposable
where T : IIncrementalGenerator, new()
{
#pragma warning disable CS0618 // Type or member is obsolete
/// <summary>
/// Represents the NuGet library dependency for the Splat library.
/// </summary>
private static readonly LibraryRange SplatLibrary =
new("Splat", VersionRange.AllStableFloating, LibraryDependencyTarget.Package);
new("Splat", VersionRange.AllStable, LibraryDependencyTarget.Package);

/// <summary>
/// Represents the NuGet library dependency for the ReactiveUI library.
/// </summary>
private static readonly LibraryRange ReactiveuiLibrary =
new("ReactiveUI", VersionRange.AllStableFloating, LibraryDependencyTarget.Package);
#pragma warning restore CS0618 // Type or member is obsolete
new("ReactiveUI", VersionRange.AllStable, LibraryDependencyTarget.Package);

private static readonly string mscorlibPath = Path.Combine(
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.SourceGenerators;

namespace SGReactiveUI.SourceGenerators.Test.Maui
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute.Maui/TestViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using System.Reactive;
using System.Reactive.Linq;
using System.Runtime.Serialization;
Expand All @@ -15,6 +16,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// <summary>
/// TestClass.
/// </summary>
[ExcludeFromCodeCoverage]
[DataContract]
public partial class TestViewModel : ReactiveObject
{
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute.Nested1/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Execute.Nested1;
/// <summary>
/// Class1.
/// </summary>
[ExcludeFromCodeCoverage]
public partial class Class1 : ReactiveObject
{
[Reactive]
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute.Nested2/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Execute.Nested2;
/// <summary>
/// Class1.
/// </summary>
[ExcludeFromCodeCoverage]
public partial class Class1 : ReactiveObject
{
[Reactive]
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute.Nested3/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Execute.Nested3;
/// <summary>
/// Class1.
/// </summary>
[ExcludeFromCodeCoverage]
public partial class Class1 : ReactiveObject
{
[Reactive]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
// See the LICENSE file in the project root for full license information.

using System.Collections.ObjectModel;
using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

namespace SGReactiveUI.SourceGenerators.Test;

[ExcludeFromCodeCoverage]
internal partial class InternalTestViewModel : ReactiveObject
{
[ReactiveCollection]
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/Person.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -12,6 +13,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// Person.
/// </summary>
/// <seealso cref="ReactiveUI.ReactiveObject" />
[ExcludeFromCodeCoverage]
public partial class Person : ReactiveObject
{
/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.SourceGenerators;
using Splat;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// <summary>
/// EntryPoint.
/// </summary>
[ExcludeFromCodeCoverage]
public static class Program
{
/// <summary>
Expand Down
3 changes: 3 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;

namespace SGReactiveUI.SourceGenerators.Test;

/// <summary>
/// TestAttribute.
/// </summary>
/// <seealso cref="System.Attribute" />
[ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
public sealed class TestAttribute : Attribute
{
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestClassOAPH_VM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// <summary>
/// TestClassOAPH VM.
/// </summary>
[ExcludeFromCodeCoverage]
public partial class TestClassOAPH_VM : ReactiveObject
{
[ObservableAsProperty]
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestViewModel2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -13,6 +14,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// </summary>
/// <typeparam name="T">the type.</typeparam>
/// <seealso cref="ReactiveUI.ReactiveObject" />
[ExcludeFromCodeCoverage]
public partial class TestViewModel2<T> : ReactiveObject
{
[Reactive]
Expand Down
2 changes: 2 additions & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestViewModel3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI;
using ReactiveUI.SourceGenerators;

Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// <summary>
/// TestViewModel3.
/// </summary>
[ExcludeFromCodeCoverage]
public partial class TestViewModel3 : ReactiveObject
{
[Reactive]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.SourceGenerators;

namespace SGReactiveUI.SourceGenerators.Test
Expand All @@ -11,6 +12,7 @@ namespace SGReactiveUI.SourceGenerators.Test
/// TestViewModel.
/// </summary>
/// <seealso cref="ReactiveUI.ReactiveObject" />
[ExcludeFromCodeCoverage]
public partial class TestViewModel
{
/// <summary>
Expand Down
3 changes: 2 additions & 1 deletion src/ReactiveUI.SourceGenerators.Execute/TestViewWpf.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using System.Windows;
using ReactiveUI;
using ReactiveUI.SourceGenerators;
Expand All @@ -13,7 +14,7 @@ namespace SGReactiveUI.SourceGenerators.Test;
/// <summary>
/// TestView.
/// </summary>
[IViewFor<TestViewModel>(RegistrationType = SplatRegistrationType.PerRequest)]
[IViewFor<TestViewModel>(RegistrationType = SplatRegistrationType.PerRequest, ViewModelRegistrationType = SplatRegistrationType.Constant)]
public partial class TestViewWpf : Window
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions src/ReactiveUI.SourceGenerators.Execute/TestViewWpf2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using System.Windows;
using ReactiveUI.SourceGenerators;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.SourceGenerators.WinForms;

namespace SGReactiveUI.SourceGenerators.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// The ReactiveUI and contributors licenses this file to you under the MIT license.
// See the LICENSE file in the project root for full license information.

using System.Diagnostics.CodeAnalysis;
using ReactiveUI.SourceGenerators.WinForms;

namespace SGReactiveUI.SourceGenerators.Test;
Expand Down
Loading
Loading