-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #868 from unoplatform/dev/dr/vmToModel
feat(feeds): Add ability to generate [Bindable]VM from Model instead of ViewModel
- Loading branch information
Showing
6 changed files
with
118 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/Uno.Extensions.Reactive.UI/Config/ImplicitBindablesAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using System.Linq; | ||
|
||
namespace Uno.Extensions.Reactive.Config; | ||
|
||
/// <summary> | ||
/// Indicates if types that matches defined suffixes should be automatically exposed as bindable friendly view models. | ||
/// </summary> | ||
/// <remarks>If disabled, you can still generates bindable friendly view model by flagging a class with the <see cref="ReactiveBindableAttribute"/>.</remarks> | ||
[AttributeUsage(AttributeTargets.Assembly)] | ||
public class ImplicitBindablesAttribute : Attribute | ||
{ | ||
/// <summary> | ||
/// Gets the legacy pattern that was used in versions prior to 2.3. | ||
/// </summary> | ||
public const string LegacyPattern = "ViewModel$"; | ||
|
||
/// <summary> | ||
/// Gets or sets a bool which indicates if the generation of view models based on class names is enabled of not. | ||
/// </summary> | ||
public bool IsEnabled { get; init; } = true; | ||
|
||
/// <summary> | ||
/// The patterns that the class FullName has to match to implicitly trigger view model generation. | ||
/// </summary> | ||
public string[] Patterns { get; } = { "Model$" }; | ||
|
||
/// <summary> | ||
/// Create a new instance using default values. | ||
/// </summary> | ||
public ImplicitBindablesAttribute() | ||
{ | ||
} | ||
|
||
/// <summary> | ||
/// Creates a new instance specifying the <see cref="Patterns"/>. | ||
/// </summary> | ||
/// <param name="patterns">The patterns that the class FullName has to match to implicitly trigger view model generation.</param> | ||
public ImplicitBindablesAttribute(params string[] patterns) | ||
{ | ||
Patterns = patterns; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters