当前位置: 首页 > news >正文

二维码生成器免费武汉seo服务多少钱

二维码生成器免费,武汉seo服务多少钱,wordpress主页链接失效,长沙景点图片安装注意事项 使用AOP的时候需要安装Autofac.Extras.DynamicProxy,如果发现VS老是提示报错,需要把VS重启下才可以识别。 WebApi 注意事项:WebApi中多一个ApiController中构造注入功能。 注入和AOP拦截 var siteNameList ClassHelper.GetConstants(typeof(SiteName));//创建…

安装注意事项

使用AOP的时候需要安装Autofac.Extras.DynamicProxy,如果发现VS老是提示报错,需要把VS重启下才可以识别。

WebApi

注意事项:WebApi中多一个ApiController中构造注入功能。

注入和AOP拦截

 var siteNameList = ClassHelper.GetConstants(typeof(SiteName));//创建容器var builder = new ContainerBuilder();//Api接口注入
builder.RegisterApiControllers(Assembly.GetExecutingAssembly());//注册api容器的实现var assemblys = BuildManager.GetReferencedAssemblies().Cast<Assembly>().ToList();//builder.RegisterAssemblyTypes(assemblys.ToArray())//查找程序集中以Service结尾的类型
//.Where(t => t.Name.EndsWith("Service"))
//.AsImplementedInterfaces();//拦截器注入builder.RegisterType<AOPInterceptor>();Type baseType = typeof(IDependency);//注册DLL并开启接口拦截,通过拦截器
// 获取所有相关类库的程序集
// 先注册匹配非工厂名开头的Service
builder.RegisterAssemblyTypes(assemblys.ToArray()).Where(type => baseType.IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract&& type.Name.EndsWith("Service")&& !siteNameList.Contains(type.Name.Substring(0, 4))).AsImplementedInterfaces().InstancePerLifetimeScope().EnableInterfaceInterceptors().InterceptedBy(typeof(AOPInterceptor));//InstancePerLifetimeScope 保证对象生命周期基于请求//后注册匹配工厂名开头的Service
builder.RegisterAssemblyTypes(assemblys.ToArray()).Where(type => baseType.IsAssignableFrom(type) && !type.GetTypeInfo().IsAbstract&& type.Name.EndsWith("Service")&& siteNameList.Contains(type.Name.Substring(0, 4)) && type.Name.Substring(0, 4) == AbstractFactory.siteConfig.SiteName).AsImplementedInterfaces().InstancePerLifetimeScope().EnableInterfaceInterceptors().InterceptedBy(typeof(AOPInterceptor));//InstancePerLifetimeScope 保证对象生命周期基于请求Autofac.IContainer container = builder.Build();var configuration = GlobalConfiguration.Configuration;//WebApi整个的解析依赖交给AutoFac     //默认构造函数注入
configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);//注册api容器需要使用HttpConfiguration对象//把所有类型都注册到AutoFac容器里,最后把整个项目的实例创建和解析依赖交给AutoFac,//这样AutoFac在创建控制器实例的时候根据参数类型(不注入的走无参构造函数),去容器取对应实例进行注入

ApiController中构造注入功能

public class PATController : ApiController
{private readonly IPATService patService;public PATController(IPATService _patService){patService = _patService;}
}

Winform

注意事项:直接以接口的方式进行注入。
注入和AOP拦截

  public class AutofacBuilder{private static IContainer _container;public static void Init(){ContainerBuilder builder = new ContainerBuilder();// builder.RegisterType<Service1>().As<Service1>(); //这一句可以不要,因为下面已经把当前程序集下的类注入了ico容器//注册拦截器到容器builder.RegisterType<AOPInterceptor>();//在注册类型到容器的时候动态注入拦截器//builder.RegisterType<DeviceI>().As<IDevice>().EnableInterfaceInterceptors().InterceptedBy(typeof(AOPInterceptor));//注册当前程序集的所有类成员builder.RegisterAssemblyTypes(System.Reflection.Assembly.GetExecutingAssembly()).AsImplementedInterfaces().EnableInterfaceInterceptors().InterceptedBy(typeof(AOPInterceptor));_container = builder.Build();  //只有在Build之后,才能调用Resolve<T>()}public static T Resolve<T>(){return _container.Resolve<T>();}}
http://www.ds6.com.cn/news/66732.html

相关文章:

  • 学院网站建设进度情况说明书郑州网站推广方案
  • 最火的做牛排沙拉网站seo网站有优化培训吗
  • 四位一体网站开发seo工作内容
  • 金泉网站建设开发重庆seo排名收费
  • 贵阳企业建站系统模板软文范例大全300字
  • wordpress用户前端创建相册上海企业优化
  • 大丰建站友情连接出售
  • 网站建好了怎么做淘宝客惠州seo建站
  • 站长统计app软件下载官网天津seo外包平台
  • 哪个门户网站做推广好网上卖产品怎么推广
  • 怎么做58同城网站网站推广和网络推广
  • 国际网站开发客户全网引流推广
  • 怎么做微商的微网站下载一个百度导航
  • 政府部门门户网站建设方案seo基础优化包括哪些内容
  • 网站建设与制作邀请注册推广赚钱的app
  • 特价旅游机票网站建设网络营销外包推广价格
  • 网站建设案例欣赏百度竞价排名的利与弊
  • 中小企业网站制作流程地推公司
  • 企业网站价格肇庆网站制作软件
  • 微信登录网页版登录入口廊坊seo排名收费
  • 算命网站开发电话刷移动关键词优化
  • 西宁网站建设公司排名个人怎么创建网站
  • 广东网站设计的公司品牌推广包括哪些内容
  • 网站开发的基本技术技能培训机构
  • wordpress 发通知厦门网站推广优化哪家好
  • 2017企业网站建设方案南山网站seo
  • 又一个 wordpress 站点深圳seo优化排名推广
  • 莱芜百度网站优化常宁seo外包
  • 网站做点线表格简述网站建设流程
  • 延庆b2c网站制作价格电商运营公司排名