MrAdvice 2.12.1

.NET 5.0 .NET Standard 2.0
dotnet add package MrAdvice --version 2.12.1
NuGet\Install-Package MrAdvice -Version 2.12.1
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="MrAdvice" Version="2.12.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MrAdvice --version 2.12.1
#r "nuget: MrAdvice, 2.12.1"
#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 MrAdvice as a Cake Addin
#addin nuget:?package=MrAdvice&version=2.12.1

// Install MrAdvice as a Cake Tool
#tool nuget:?package=MrAdvice&version=2.12.1

Mr. Advice

Summary

Mr. Advice is an open source (and free of charge) alternative to PostSharp (which is still far more advanced, see https://www.postsharp.net).
It intends to inject aspects at build-time. Advices are written in the form of attributes, and marking methods with them makes the pointcut, resulting in a nice and easy aspect injection.
More information about what is an aspect at Wikipedia.

Mr. Advice can weave assemblies for:

  • .NET framework ≥4.6.1 / Mono
  • .NET ≥5
  • .NET Standard 2.0

Mr. Advice allows you to:

  • Advise methods or parameters, at assembly, type, method or parameter level
  • Advice types (at assembly startup)
  • Introduce fields
  • Advise Mr. Advice (and this is BIG) at weaving-time (during build step), so you can rename methods as they are advised, add properties, etc.

How it works

It is available as a NuGet Status package. There is also an automatic build with tests at appveyor. The current status is Build status

Philosophy

Currently, MrAdvice won't bring you any aspect out-of-the-box. This means you'll have to write your own aspects (however you can see below other packages using Mr. Advice).
So it brings us to the next chapter, which is...

How to implement your own aspects

In a nutshell

Here is the minimal sample:

public class MyProudAdvice : Attribute, IMethodAdvice
{
    public void Advise(MethodAdviceContext context)
    {
        // do things you want here
        context.Proceed(); // this calls the original method
        // do other things here
    }
}

You then just need to mark the method(s) with the attribute and that's it, your aspect is injected!

[MyProudAdvice]
public void MyProudMethod()
{
}

More details

Your aspects can be injected at assembly, type or method level, simply by setting the attribute:

  • When an aspect is injected at asembly level, all methods of all types are weaved.
  • When the aspect is injected at type level, all of its methods are weaved.
  • And of course, if the aspect is injected on a method, only the method is weaved.

Other projects using Mr. Advice

NuGet packages:

Miscellaneous projects:

Project owner is picrap, feel free to drop a mail ✉️.
Project company is Arx One, a french company editor of backup software solutions.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (16)

Showing the top 5 NuGet packages that depend on MrAdvice:

Package Downloads
MrAdvice.Fody

Obsolete! Use https://www.nuget.org/packages/MrAdvice/ instead! MrAdvice allows to weave aspects at build-time (just like PostSharp, but free as in free beer). Write your own aspects in the form of attributes and apply them to target methods or properties.

MrAdvice.MVVM

MrAdvice.MVVM is a lightweight MVVM library. It implements NotifyPropertyChanged, DependencyProperty (dependency and attached), A command binder and some threading management.

ZLSoft.QWPlatform.SystemLibraryCore

v6.0.0.0 .net 6 v.3.0.5.47 消息队列订阅是抛出异常 v3.0.5.46 增加获取授权文件有效期方法 v3.0.5.45 增加授权文件解析类 v3.0.5.44 扩展mysql支持 v3.0.5.43 增加调用webServiceSOAP方法 v3.0.5.41 & 42 修改日志生成到队列发送用户名控制器、方法名称 v3.0.5.39 & 40 1.修改读取日志消息队列配置,设置到app.json文件中 v3.0.5.38 1.修改所有配置读取,全部读取app.json文件 2.修改数据查询时访问统计SQL信息 v3.0.5.36 删除日志调用堆栈信息 v3.0.5.35 & 36 1.配置config/debug.json可以实现每个方法注入监控 2.修改日志方法 v3.0.5.34 扩展枚举类型,获取自定义描述信息 v3.0.5.33 修改获取ModelList如果没有数据则返回List为0的列表 v3.0.5.32 修改CopyToModel,两种方式支持使用json方式 v3.0.5.30 &31 增加JToken值获取 v3.0.5.29 增加根据数据表获取列集合功能 v3.0.5.28 增加转换model时使用枚举值 v3.0.5.26 优化CopyToModel的应用性,提高复制成功机率与容错处理 v3.0.5.25 升级消息队列消费带初始化参数处理 v3.0.5.24 优化连接RabbitMQ的消息发送机制 v3.0.5.23 1.优化日志输出 v3.0.5.22 修改日志写入消息队列的BUG v3.0.5.21 1.修改数据库连接打开方式移除polly方式 2.增加消息队列管理 v3.0.5.20 修改Guid生成字16位字符串与生成19位的Long类型 v3.0.5.19 1.增加统一日志处理方式 2.增加动态编译方法 v3.0.5.18 1.增加身份证调用判断 v3.0.5.17 发布调用webservice的功能 v3.0.5.16 实现SQL脚本统一监听功能 v3.0.5.15 Fix缓存过期时间问题(Redis) v3.0.5.14 修改md5加密的编码问题 v3.5.0.13 修改SQL监听对象的存储使用安全字典存储 v3.5.0.12 修改数据库查询赋值可为空的对象 v3.5.0.11 集成认证功能(配置auth.json文件) v3.5.0.10 修正3.5.0.9的缓存bug,添加CSRedisCore代码内置,减少dll的引用 v3.5.0.8 实现缓存管理(内存缓存及Redis缓存控制),及消息订阅与发布 v3.5.0.7 修改在centos下日志输出的问题

SD.AOP.Core

SD.AOP 面向方面编程基础

ArxOne.Persistence

A simple persistence library. Simply mark properties with attributes and they are persisted in registry.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.12.1 72 3/28/2023
2.12.0 186 3/11/2023
2.11.3 142 3/5/2023
2.11.2 85 3/5/2023
2.11.1 81 3/5/2023
2.11.0 89 3/5/2023
2.10.1 1,373 12/20/2022
2.10.0 200 12/19/2022
2.9.9 1,074 11/5/2022
2.9.8 3,271 9/21/2022
2.9.7 20,897 2/18/2022
2.9.6 726 1/28/2022
2.9.6-testing3 108 1/25/2022
2.9.6-testing2 107 1/24/2022
2.9.6-testing1 111 1/6/2022
2.9.5 3,705 12/18/2021
2.9.4 1,313 12/1/2021
2.9.3 278 11/27/2021
2.9.2 7,697 9/17/2021
2.9.1 906 8/1/2021
2.9.0 8,990 4/26/2021
2.9.0-test1 195 4/25/2021
2.8.12 42,395 12/24/2020
2.8.11 6,880 7/19/2020
2.8.10 4,391 2/16/2020
2.8.9-embed1 1,956 1/9/2020
2.8.8 18,597 10/5/2019
2.8.7 499 10/5/2019
2.8.6 7,313 9/6/2019
2.8.5 15,701 3/29/2019
2.8.4 1,898 3/27/2019
2.8.3 2,248 3/18/2019
2.8.2 29,326 11/29/2018
2.8.1 2,243 11/29/2018
2.8.0 2,063 11/28/2018
2.7.2 2,870 10/23/2018
2.7.1 2,007 10/23/2018
2.7.0 2,389 10/8/2018
2.6.0 9,784 9/24/2018
2.5.30 2,027 9/23/2018
2.5.29 2,014 9/21/2018
2.5.28 2,029 9/20/2018
2.5.27 2,013 9/20/2018
2.5.25 11,356 8/12/2018
2.5.24 21,506 2/13/2018
2.5.23 2,274 2/8/2018
2.5.22 2,299 2/8/2018
2.5.21 2,232 2/7/2018
2.5.20 2,320 2/2/2018
2.5.19 6,143 12/17/2017
2.5.18 2,320 12/17/2017
2.5.18-pre2 2,031 11/11/2017
2.5.18-pre 2,056 11/8/2017
2.5.18-exp4 2,115 12/17/2017
2.5.18-exp3 2,126 12/15/2017
2.5.17 20,411 11/1/2017
2.5.16 5,707 8/14/2017
2.5.15 2,207 8/12/2017
2.5.14 2,149 8/11/2017
2.5.13 2,175 8/10/2017
2.5.12 2,148 8/9/2017
2.5.11 2,205 8/7/2017
2.5.10 2,257 8/7/2017
2.5.9 2,174 8/6/2017
2.5.8 2,184 8/6/2017
2.5.7 2,144 8/6/2017
2.5.6 2,169 8/5/2017
2.5.5 2,173 8/5/2017
2.5.4 16,025 6/26/2017
2.5.3 2,232 6/25/2017
2.5.2 2,264 6/14/2017
2.5.1 2,334 5/24/2017
2.5.0 2,509 4/16/2017
2.4.8 4,900 3/15/2017
2.4.7 2,453 3/10/2017
2.4.6 2,184 3/10/2017
2.4.5 9,898 12/28/2016
2.4.4 2,282 12/27/2016
2.4.3 3,179 12/7/2016
2.4.2 2,273 12/3/2016
2.4.1 2,201 12/3/2016
2.4.1-test1 2,107 12/2/2016
2.4.0 2,313 11/25/2016
2.4.0-test5 2,126 11/24/2016
2.4.0-test4 2,126 11/23/2016
2.3.5 2,338 11/10/2016
2.3.5-pre1 2,500 11/8/2016
2.3.5-name1 2,125 11/10/2016
2.3.4 2,376 11/8/2016
2.3.2 2,401 11/7/2016
2.3.1 2,585 11/6/2016
2.2.0 2,706 11/5/2016
2.1.3 2,516 11/2/2016
2.1.2 2,361 10/24/2016
2.1.1 2,220 10/24/2016
2.1.0 2,399 10/22/2016
2.1.0-pre3 2,092 10/21/2016
2.1.0-pre2 2,083 10/20/2016
2.1.0-pre1 2,141 10/19/2016
2.0.22 2,269 10/19/2016
2.0.21 2,279 10/19/2016
2.0.20 2,232 10/18/2016
2.0.19 2,213 10/18/2016
2.0.18 2,248 10/18/2016
2.0.17 2,240 10/18/2016
2.0.16 2,223 10/17/2016
2.0.15 2,216 10/17/2016
2.0.14 2,217 10/17/2016
2.0.13 2,262 10/16/2016
2.0.12 2,253 10/16/2016
2.0.10 2,220 10/15/2016
2.0.9 2,237 10/14/2016
2.0.8 2,252 10/13/2016
2.0.7 2,253 10/13/2016
2.0.6 2,216 10/12/2016
2.0.5 2,217 10/8/2016
2.0.4 2,236 10/8/2016
2.0.3 2,221 10/8/2016
2.0.2 2,217 10/8/2016
2.0.1 2,231 10/8/2016
2.0.0 3,344 10/2/2016
2.0.0-alpha4 2,072 10/2/2016