$(ProjectDir)Libs\Afterthought\Afterthought.Amender.exe "$(TargetPath)" "$(TargetDir)EntityFramework.Patterns.dll"
我实际上分析代码好久,也没整明白它是怎么运行的,看一下官方文档明白了,原来。。。
Next, add the following as a post build step to your project to call the Afterthought Amender executable:
$(SolutionDir)packages\Afterthought.1.0.8\tools\Afterthought.Amender.exe "$(TargetPath)"Please note that the
\Afterthought.1.0.8\portion of the path should reflect the version of Afterthought that you are using. You can also use theAmenderbuild task in your project, but this requires manually editing the project to add this task. Since NuGet currently does not support modifying the project file directly in this way, Afterthought does not automatically configure itself to run for referenced projects.If you instead chose to go the source route, simply configure your target project to call
Afterthought.Amender.exereferencing the compiled output of the `Afterthought.Amender' project. Also, you can debug the amendment process by configuring the 'Afterthought.Amender' project to amend your target assembly and run this project in debug mode.
原来在事件后期执行这样的一个操作。
根据我们一直的习惯,直接在代码中解决问题的,但是这个工具是先编译通过,然后通过一个EXE程序来修改程序集,以达到效果。
然后修改的程序集你再用ILSpay看,会发现,
原始代码:
[Auditable]
public class AuditableEntity
{
public int Id { get; set; }
public string Color { get; set; }
}