Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ ReactiveUI Source Generators automatically generate ReactiveUI objects to stream
- `[ReactiveCommand(OutputScheduler = "RxApp.MainThreadScheduler")]` using a ReactiveUI Scheduler
- `[ReactiveCommand(OutputScheduler = nameof(_isheduler))]` using a Scheduler defined in the class
- `[ReactiveCommand][property: AttributeToAddToCommand]` with Attribute passthrough
- `[ReactiveCommand(AccessModifier = PropertyAccessModifier.Internal)]` sets the access modifier of the generated command property
- `[IViewFor(nameof(ViewModelName))]`
- `[IViewFor<YourViewModelType>]`
- `[IViewFor("YourNameSpace.YourGenericViewModel<int>")]` Generic
- `[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.PerRequest)]` with Splat Registration Type for IViewFor registration.
- `[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.LazySingleton)]` Generic with Splat Registration Type for IViewFor registration.
- `[IViewFor<YourViewModelType>(RegistrationType = SplatRegistrationType.Constant)]` Generic with Splat Registration Type for IViewFor registration.
- `[IViewFor<YourViewModelType>(ViewModelRegistrationType = SplatRegistrationType.PerRequest)]` Generic with Splat Registration Type for ViewModel registration.
- `[IViewFor<YourViewModelType>(ViewModelRegistrationType = SplatRegistrationType.LazySingleton)]` Generic with Splat Registration Type for ViewModel registration.
- `[IViewFor<YourViewModelType>(ViewModelRegistrationType = SplatRegistrationType.Constant)]` Generic with Splat Registration Type for ViewModel registration.
- `[RoutedControlHost("YourNameSpace.CustomControl")]`
- `[ViewModelControlHost("YourNameSpace.CustomControl")]`
- `[BindableDerivedList]` Generates a derived list from a ReadOnlyObservableCollection backing field
Expand Down Expand Up @@ -544,6 +548,17 @@ public partial class MyReactiveClass
}
```

### Usage ReactiveCommand with AccessModifier
```csharp
using ReactiveUI.SourceGenerators;

public partial class MyReactiveClass
{
[ReactiveCommand(AccessModifier = PropertyAccessModifier.Internal)]
private void Execute() { }
}
```

## Usage IViewFor `[IViewFor(nameof(ViewModelName))]`

### IViewFor usage
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
2 changes: 1 addition & 1 deletion src/ReactiveUI.SourceGenerators.Execute/TestViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ protected virtual void Dispose(bool disposing)
/// </summary>
/// <param name="i">The i.</param>
/// <returns>An Observable of int.</returns>
[ReactiveCommand]
[ReactiveCommand(AccessModifier = PropertyAccessModifier.Internal)]
private IObservable<double?> Test8Observable(int i) => Observable.Return<double?>(i + 10.0);

[ReactiveCommand]
Expand Down
21 changes: 21 additions & 0 deletions src/ReactiveUI.SourceGenerators.Roslyn/AttributeDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ internal enum AccessModifier
Init,
}

/// <summary>
/// Property Access Modifier.
/// </summary>
internal enum PropertyAccessModifier
{
Public,
Protected,
Internal,
Private,
InternalProtected,
PrivateProtected,
}

/// <summary>
/// InheritanceModifier.
/// </summary>
Expand Down Expand Up @@ -128,6 +141,14 @@ internal sealed class ReactiveCommandAttribute : global::System.Attribute
/// The output scheduler.
/// </value>
public string? OutputScheduler { get; init; }

/// <summary>
/// Gets the AccessModifier of the ReactiveCommand property.
/// </summary>
/// <value>
/// The AccessModifier of the property.
/// </value>
public PropertyAccessModifier AccessModifier { get; init; }
}
#nullable restore
#pragma warning restore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ internal record CommandInfo(
string? CanExecuteObservableName,
CanExecuteTypeInfo? CanExecuteTypeInfo,
string? OutputScheduler,
EquatableArray<string> ForwardedPropertyAttributes)
EquatableArray<string> ForwardedPropertyAttributes,
string AccessModifier)
{
private const string UnitTypeName = "global::System.Reactive.Unit";

Expand Down
Loading
Loading