PostSharp Aop(安装)
2015-02-11 14:18
316 查看
项目中 Business层,大多数代码都是public static fun(string xx) 这样的代码,没有接口。AOP 对象都是依赖于接口的,对于这种无接口的类有没有办法AOP。
答案有肯定的。可以用PostSharp。
AOP 依赖接口的我称之为动态AOP,编译时(MSIL)称之为静态AOP。
PostSharp,mono.cecil 都是商业版的,都可以静态AOP。
castle,微软企业库,spring.net 都是动态AOP。
引用星爷的一句话:谁说没有枪头就捅不死人(谁说非要接口才能AOP)。
下载
https://www.postsharp.net/purchase
所有的Project 必须Add postSharp to Project。只引用DLL是无法使用AOP的。
添加完毕后.csproj文件用文本打开,会有Msbuild信息。
postsharp 2.0之前没有Msbuild,2.0之后会存在Msbuild信息。
答案有肯定的。可以用PostSharp。
AOP 依赖接口的我称之为动态AOP,编译时(MSIL)称之为静态AOP。
PostSharp,mono.cecil 都是商业版的,都可以静态AOP。
castle,微软企业库,spring.net 都是动态AOP。
引用星爷的一句话:谁说没有枪头就捅不死人(谁说非要接口才能AOP)。
下载
https://www.postsharp.net/purchase
所有的Project 必须Add postSharp to Project。只引用DLL是无法使用AOP的。
添加完毕后.csproj文件用文本打开,会有Msbuild信息。
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="..\..\..\packages\PostSharp.4.0.41\tools\PostSharp.targets" Condition="Exists('..\..\..\packages\PostSharp.4.0.41\tools\PostSharp.targets')" /> <Target Name="EnsurePostSharpImported" BeforeTargets="BeforeBuild" Condition="'$(PostSharp30Imported)' == ''"> <Error Condition="!Exists('..\..\..\packages\PostSharp.4.0.41\tools\PostSharp.targets')" Text="This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://www.postsharp.net/links/nuget-restore." /> <Error Condition="Exists('..\..\..\packages\PostSharp.4.0.41\tools\PostSharp.targets')" Text="The build restored NuGet packages. Build the project again to include these packages in the build. For more information, see http://www.postsharp.net/links/nuget-restore." /> </Target>
postsharp 2.0之前没有Msbuild,2.0之后会存在Msbuild信息。
相关文章推荐
- 基于.NET的AOP开源框架PostSharp 1.0 beta发布
- PostSharp AOP
- 由浅入深CIL系列【目录索引】+ PostSharp AOP编程【目录索引】
- AOP - PostSharp 2.0
- PostSharp AOP学习研究(一)
- Aop面向方面编程之PostSharp框架
- PostSharp的AOP设计在.NET Remoting中的应用
- .NET下的AOP: PostSharp 原理分析
- AOP之PostSharp3-MethodInterceptionAspect
- 使用PostSharp在.NET平台上实现AOP
- 使用PostSharp在.NET平台上实现AOP
- AOP之PostSharp初见-OnExceptionAspect
- PostSharp AOP编程:1.基于PostSharp的AOP日志记录和异常捕捉【附带源码】
- AOP - PostSharp 2.0
- 10分钟入门AOP:用PostSharp普及一下AOP
- AOP - PostSharp 2.0
- 基于.NET的AOP开源框架PostSharp 1.0 beta发布
- PostSharp:不错的aop框架
- AOP 系列: 使用PostSharp在.NET平台上实现AOP
- 基于PostSharp的AOP框架设计