PrismCommands.Fody 1.0.2

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package PrismCommands.Fody --version 1.0.2                
NuGet\Install-Package PrismCommands.Fody -Version 1.0.2                
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="PrismCommands.Fody" Version="1.0.2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add PrismCommands.Fody --version 1.0.2                
#r "nuget: PrismCommands.Fody, 1.0.2"                
#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 PrismCommands.Fody as a Cake Addin
#addin nuget:?package=PrismCommands.Fody&version=1.0.2

// Install PrismCommands.Fody as a Cake Tool
#tool nuget:?package=PrismCommands.Fody&version=1.0.2                

PrismCommands.Fody

PrismCommands.Fody is a Fody plugin that provides a simple way to replace methods with Prism DelegateCommand properties at compile time.

This is useful when using the Prism library to build applications with the Model-View-ViewModel (MVVM) architecture. DelegateCommand is a class provided by Prism that implements the ICommand interface and allows you to bind a command from the view to a method in the view model.

Installation

  1. Install the PrismCommands.Fody NuGet package in your project.
  2. Add a [DelegateCommand] attribute to any method in your code that you want to replace with a DelegateCommand property.
  3. Build your project. The methods with the [DelegateCommand] attribute will be replaced with DelegateCommand properties.

Example

public class MyViewModel
{
    [DelegateCommand]
    public void DoSomething()
    {
        // Do something here.
    }
}

After building, each method marked with the [DelegateCommand] attribute will be replaced with a corresponding DelegateCommand property named using the "{MethodName}Command" pattern.

For example, if you have a MyViewModel class with a method named DoSomething marked with the [DelegateCommand] attribute, after building, this method will be replaced with a property named DoSomethingCommand.

public class MyViewModel
{
    public DelegateCommand DoSomethingCommand { get; private set; }

    public MyViewModel()
    {
        DoSomethingCommand = new DelegateCommand(DoSomething);
    }

    private void DoSomething()
    {
        // Do something here.
    }
}

Thus, you can use the DoSomethingCommand property to bind the command to the view.

Note that if you have a method with a name that matches the property name created by PrismCommands.Fody, this can lead to conflicts and build errors. To avoid this, avoid using strings in method names that match the "Command" string.

How it works

PrismCommands.Fody uses the Mono.Cecil library to modify the assembly at compile time. It scans the assembly for methods with the [DelegateCommand] attribute and replaces them with DelegateCommand properties.

The implementation details can be found in the ModuleWeaver class.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue. If you want to contribute code, please fork the repository and submit a pull request.

License

PrismCommands.Fody is licensed under the MIT License.

Product 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 is compatible. 
.NET Framework net452 is compatible.  net46 was computed.  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.
  • .NETFramework 4.5.2

  • .NETStandard 2.0

  • .NETStandard 2.1

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
2.0.8 253 7/5/2023
2.0.7 148 5/31/2023
2.0.6 159 5/2/2023
2.0.5 173 4/25/2023
2.0.4 176 4/23/2023
2.0.1 190 4/12/2023
2.0.0 194 4/10/2023
1.0.10 202 4/9/2023
1.0.9 192 4/8/2023
1.0.8 228 4/7/2023
1.0.6 209 4/6/2023
1.0.3 189 4/5/2023
1.0.2 201 4/5/2023
1.0.1 191 4/5/2023
1.0.0 193 4/5/2023