SourceCrafter.ViewModelGenerator
1.24.74.428
dotnet add package SourceCrafter.ViewModelGenerator --version 1.24.74.428
NuGet\Install-Package SourceCrafter.ViewModelGenerator -Version 1.24.74.428
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SourceCrafter.ViewModelGenerator" Version="1.24.74.428" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add SourceCrafter.ViewModelGenerator --version 1.24.74.428
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SourceCrafter.ViewModelGenerator, 1.24.74.428"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install SourceCrafter.ViewModelGenerator as a Cake Addin #addin nuget:?package=SourceCrafter.ViewModelGenerator&version=1.24.74.428 // Install SourceCrafter.ViewModelGenerator as a Cake Tool #tool nuget:?package=SourceCrafter.ViewModelGenerator&version=1.24.74.428
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
✨ SourceCrafter.ViewModelGenerator: Simple partial classes for observable view models
Given the following spec interface
public enum Role
{
Admin,
Moderator,
Guest,
User
}
[ObservableModel]
public interface IUser
{
string FirstName { get; set; }
[Ignore]
string? LastName { get; set; }
int Age { get; set; }
bool CanDrink { get; set; }
string Name => $"{FirstName} {LastName}".Trim();
bool IsUnder18
{
get => Age >= 18;
set
{
Age = value ? 18 : 17;
CanDrink = !IsUnder18;
}
}
}
should generates the following view model class (based on the previous definition example):
public partial class User : ViewModelBase, IUser
{
private string
_firstName;
private int
_age;
private bool
_canDrink;
private static readonly PropertyChangedEventArgs
_nameChangedEvtArg = new("Name"),
_isUnder18ChangedEvtArg = new("IsUnder18"),
_firstNameChangedEvtArg = new("FirstName"),
_ageChangedEvtArg = new("Age"),
_canDrinkChangedEvtArg = new("CanDrink");
public string Name => $"{FirstName} {LastName}".Trim();
public bool IsUnder18 {
get => Age >= 18;
set {
Age = value ? 18 : 17;
if (IsUnder18) CanDrink = true; else CanDrink = false;
OnPropertyChanged(_isUnder18ChangedEvtArg);
}
}
public string FirstName
{
get => _firstName;
set {
if(value == _firstName)
return;
_firstName = value;
OnPropertyChanged(_firstNameChangedEvtArg);
OnPropertyChanged(_nameChangedEvtArg);
}
}
public string? LastName { get; set; }
public int Age
{
get => _age;
set {
if(value == _age)
return;
_age = value;
OnPropertyChanged(_ageChangedEvtArg);
OnPropertyChanged(_isUnder18ChangedEvtArg);
}
}
public bool CanDrink
{
get => _canDrink;
set {
if(value == _canDrink)
return;
_canDrink = value;
OnPropertyChanged(_canDrinkChangedEvtArg);
OnPropertyChanged(_isUnder18ChangedEvtArg);
}
}
private partial bool CanExecuteAddParent(Role parameter);
private partial Task ExecuteAddParentAsync(Role parameter);
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.24.74.428 | 132 | 3/14/2024 |
1.24.70.57 | 254 | 3/10/2024 |
0.23.302.20 | 225 | 10/29/2023 |
0.23.233.61 | 138 | 8/21/2023 |
0.23.201.96 | 189 | 7/20/2023 |
0.23.155.57 | 139 | 6/4/2023 |
0.23.155.11 | 130 | 6/4/2023 |
0.23.149.61 | 131 | 5/29/2023 |
0.23.149.53 | 124 | 5/29/2023 |
0.23.148.15 | 150 | 5/28/2023 |
0.23.122.16 | 127 | 5/2/2023 |
0.23.121.81 | 135 | 5/1/2023 |
Move implementations to use abstract clases