RaisingStudio.SessionFactory 发布 0.1版

功能描述:

  1. 支持Orchard中方便使用自定义数据库连接。

  2. 连接信息可配置。

用法:

  1. 构造函数中添加IRepositoryFactory引用

        private readonly IRepositoryFactory _repositoryFactory;

        public HomeController(IRepositoryFactory repositoryFactory)
        {
            _repositoryFactory = repositoryFactory;
        }

  2. 使用GetRepository<T>(string name),获取指定数据库连接的IRepository<T>

            IRepository<ConnectionsRecord> connectionRecordRepository = _repositoryFactory.GetRepository<ConnectionsRecord>("SqlServer DEV");
            var count = connectionRecordRepository.Table.Count();

下载地址:https://gallery.orchardproject.net/List/Modules/Orchard.Module.RaisingStudio.SessionFactory

GitHub地址:https://github.com/zhongzf/Orchard.Platform-Modules

原文地址:https://www.cnblogs.com/zhongzf/p/3516462.html