nopcommerce 4.1 core 插件 相关1
nop中 插件机制是比较值得学习的:
Nop 插件学习:
1、 项目里面的生成必须是采用 直接编辑项目文件,参考nop原本的项目文件

动态加载插件的方法-mvc3 参考:
using System.Linq;
using System.Web;
using System.IO;
using System.Web.Hosting;
using System.Web.Compilation;
using System.Reflection;
[assembly: PreApplicationStartMethod(typeof(PluginFramework.Plugins.PreApplicationInit), "Initialize")]
namespace PluginFramework.Plugins
{
public class PreApplicationInit
{
static PreApplicationInit()
{
PluginFolder = new DirectoryInfo(HostingEnvironment.MapPath("~/plugins"));
ShadowCopyFolder = new DirectoryInfo(HostingEnvironment.MapPath("~/plugins/temp"));
}
/// <summary>
/// The source plugin folder from which to shadow copy from
/// </summary>
/// <remarks>
/// This folder can contain sub folderst to organize plugin types
/// </remarks>
private static readonly DirectoryInfo PluginFolder;
/// <summary>
/// The folder to shadow copy the plugin DLLs to use for running the app
/// </summary>
private static readonly DirectoryInfo ShadowCopyFolder;
public static void Initialize()
{
Directory.CreateDirectory(ShadowCopyFolder.FullName);
//clear out plugins)
foreach (var f in ShadowCopyFolder.GetFiles("*.dll", SearchOption.AllDirectories))
{
f.Delete();
}
//shadow copy files
foreach (var plug in PluginFolder.GetFiles("*.dll", SearchOption.AllDirectories))
{
var di = Directory.CreateDirectory(Path.Combine(ShadowCopyFolder.FullName, plug.Directory.Name));
// NOTE: You cannot rename the plugin DLL to a different name, it will fail because the assembly name is part if it's manifest
// (a reference to how assemblies are loaded: http://msdn.microsoft.com/en-us/library/yx7xezcf )
File.Copy(plug.FullName, Path.Combine(di.FullName, plug.Name), true);
}
// Now, we need to tell the BuildManager that our plugin DLLs exists and to reference them.
// There are different Assembly Load Contexts that we need to take into account which
// are defined in this article here:
// http://blogs.msdn.com/b/suzcook/archive/2003/05/29/57143.aspx
// * This will put the plugin assemblies in the 'Load' context
// This works but requires a 'probing' folder be defined in the web.config
foreach (var a in
ShadowCopyFolder
.GetFiles("*.dll", SearchOption.AllDirectories)
.Select(x => AssemblyName.GetAssemblyName(x.FullName))
.Select(x => Assembly.Load(x.FullName)))
{
BuildManager.AddReferencedAssembly(a);
}
// * This will put the plugin assemblies in the 'LoadFrom' context
// This works but requires a 'probing' folder be defined in the web.config
// This is the slowest and most error prone version of the Load contexts.
//foreach (var a in
// ShadowCopyFolder
// .GetFiles("*.dll", SearchOption.AllDirectories)
// .Select(plug => Assembly.LoadFrom(plug.FullName)))
//{
// BuildManager.AddReferencedAssembly(a);
//}
// * This will put the plugin assemblies in the 'Neither' context ( i think )
// This nearly works but fails during view compilation.
// This DOES work for resolving controllers but during view compilation which is done with the RazorViewEngine,
// the CodeDom building doesn't reference the plugin assemblies directly.
//foreach (var a in
// ShadowCopyFolder
// .GetFiles("*.dll", SearchOption.AllDirectories)
// .Select(plug => Assembly.Load(File.ReadAllBytes(plug.FullName))))
//{
// BuildManager.AddReferencedAssembly(a);
//}
}
}
}
<!-- AddThis Button BEGIN --><div class="addthis_toolbox addthis_default_style "><a class="addthis_button_preferred_1"></a><a class="addthis_button_preferred_2"></a><a class="addthis_button_preferred_3"></a><a class="addthis_button_preferred_4"></a><a class="addthis_button_compact"></a><a class="addthis_counter addthis_bubble_style"></a></div><script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=nopsolutions"></script><!-- AddThis Button END -->
nopcommerce 4.1 core 插件 相关1的更多相关文章
- TeamCity : .NET Core 插件
笔者在<TeamCity : 配置 Build 过程>一文中提到 "TeamCity 内置支持几乎所有的 build 类型".在当今这个软件语言和各种框架飞速发展的时代 ...
- 2.1 -1.0 Xcode(发布时间、使用、快捷键、插件相关)
本文并非最终版本,如有更新或更正会第一时间置顶,联系方式详见文末 如果觉得本文内容过长,请前往本人 “简书” 1.0 Xcode 发布时间 版本 iOS 版本 手机 日期 特殊介绍 Xcode 3.1 ...
- NopCommerce架构分析之四----插件机制
NopCommerce支持灵活的插件机制,所谓Web系统插件,其实也就是可以像原系统的一部分一样使用. Web系统的使用方式就是客户端发送一个请求,服务端进行解析.在asp.net MVC中对客户请求 ...
- FastAdmin CMS 插件相关文章收集(2018-08-16)
FastAdmin CMS 插件相关文章收集(2018-08-16) CMS内容管理系统(含小程序) 介绍 https://www.fastadmin.net/store/cms.html CMS内容 ...
- Cordova插件相关常用命令
一,插件相关常用命令 1,查看所有已经安装的插件 1 cordova plugin ls 2,安装插件(以camera插件为例) 1 cordova plugin add cordova-plug ...
- nopcommerce插件相关
注意Description.txt中,以下字段必须配置当前可用.我抄人家代码的时候,人家是3.4 我也配成3.4,结果我的nop是3.7的,后台半天显示不出来插件,浪费了一下午.
- NopCommerce用.net core重写ef
最近看了NopCommerce源码,用core学习着写了一个项目,修改的地方记录下.项目地址 NopCommerce框架出来好久了.18年的第一季度 懒加载出来后也会全部移动到.net core.那么 ...
- 【原创】MVC项目中使用JQuery的upladify图片上传插件相关问题的解决方案
一. 关于Uploadify Uploadify是一个jQuery插件,你可以很容易的为你的网站添加多个文件上传功能.有两个不同的版本(HTML5和Flash)允许你灵活选择为您的网站和回退方法正确实 ...
- ASP.NET MVC 下使用支付宝支付接口 以及 ASP.NET Core 下相关改造支付
通过nuget首先引用AopSdk.dll 包 下面写的是 Asp.Net MVC 下相关的支付接口 APP支付 配置客户端相关的参数,配置成自己的代码就可以了 private string APPI ...
随机推荐
- speech
1.李开复:一个人的成功,15%靠专业知识,其余15%人际沟通,公众演讲,以及影响他人的能力 2.演讲是一门遗憾的艺术 3.没有准备就等于准备失败 4.追求完美,就是在追求完蛋 5.宁可千日无机会,不 ...
- 剑指offer 14:链表中倒数第k个节点
题目描述 输入一个链表,输出该链表中倒数第k个结点. /* public class ListNode { int val; ListNode next = null; ListNode(int va ...
- 关于AMD 、CMD、 commonjs的认识
首先什么是amd.cmd和commonjs.总的来说,这三个玩意就是js的模块规范. 但是,这三者有什么区别呢.... amd规范是应用于浏览器,如requireJS. commonjs规范应用与服务 ...
- C++_day8pm_多态
1.什么是多态 2. 示例代码: #include <iostream> using namespace std; //形状:位置.绘制 //+--圆形:半径.(绘制) //+--矩形:长 ...
- 【笔记】Rancher2.1容器云平台新特性
2018年10月6日,Rancher2.1版本正式发布.相比Rancher2.0版本,提供了许多新的特性: 1.支持集群和项目级别的硬件资源配额管理:2.支持3个节点的Rancher Server的管 ...
- vue项目知识点总结
一.vue中如何获取select被选中的id和对应的值. <!-- 下拉框 --> <div v-show="moreStore" class="sel ...
- shell脚本while read line的使用
#### 题目要求计算文档a.txt中每一行中出现的数字个数并且要计算一下整个文档中一共出现了几个数字.例如a.txt内容如下:12aa*lkjskdjalskdflkskdjflkjj我们脚本名字为 ...
- 微信小程序1rpx border ios真机显示不全问题
无意间测试发现,把border的颜色的透明度颜色改成0.99就可以了.1就不行. 边框显示不全的写法: border:1rpx solid rgba(244,84,80,1); 将边框代码的透明度改成 ...
- weblogic安装部署ODM下jrules-res-xu-WL10.rar出现Can't find com.ibm.rules.res.xu.messages bundle异常
Windows: weblogic用户新建域文件夹里面,bin目录下找到setDomainEnv.cmd文件 在set JAVA_OPTIONS=%JAVA_OPTIONS% 后面添加: " ...
- Vue项目本地run与build后样式不同,build后样式不生效
今天老大,让我改一个按钮的样式,就是鼠标放在按钮上,改变字体的颜色.觉得小意思啦,不就是:hover吗? 啊...什么鬼?本地run可以,但是build之后并没有生效!!! 我们项目引入的第三方UI库 ...