git上有好用的mvc框架或者mvc code的框架吗

-一个大坑 2019-06-29 05:32:08
我用的这个不太好用,想换一个
...全文
140 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
-一个大坑 2019-07-02
  • 打赏
  • 举报
回复

//連接數據庫
            var strConnectionString = Configuration.GetConnectionString ("DB");
            services.AddDbContext<WZSPCMContext>(optionsBuilder => optionsBuilder.UseSqlServer(strConnectionString));
            services.AddScoped(typeof(IBaseRepository<>), typeof(BaseRepository<>));
            services.BuildAspectCoreWithAutofacServiceProvider();

public static IServiceProvider BuildAspectCoreWithAutofacServiceProvider(IServiceCollection services, Action<IAspectConfiguration> config = null)
        {
if (services == null) throw new ArgumentNullException(nameof(services));
            services.AddAspectCoreContainer();
            if (_otherAssembly != null)
            {
                foreach (var item in _otherAssembly)
                {
                    _builder.RegisterAssemblyTypes(Assembly.Load(item));
                }
            }

            if (_types != null)
            {
                foreach (var type in _types)
                {
                    _builder.RegisterType(type);
                }
            }

            if (_dicTypes != null)
            {
                foreach (var dicType in _dicTypes)
                {
                    _builder.RegisterType(dicType.Value).As(dicType.Key);
                }
            }

            _builder.Populate(services);
            _builder.RegisterDynamicProxy(config);
            _container = _builder.Build();
            return new AutofacServiceProvider(_container);
        }

public static T Resolve<T>()
        {
            return _container.Resolve<T>();
        }
-一个大坑 2019-07-02
  • 打赏
  • 举报
回复
引用 5 楼 caozhy 的回复:
mef依赖注入 + entity framework
我用的Autofac,感觉数据不是最新,我改表里数据,查询后还是旧数据 _context = AutofacContainer.Resolve<IBaseRepository<MyfaData>>();
threenewbee 2019-07-02
  • 打赏
  • 举报
回复
引用 4 楼 -一个大坑 的回复:
[quote=引用 3 楼 caozhy 的回复:] 好用的框架一般都是前端的。毕竟后端都是业务,业务又各不相同
主要生成model后,操作model方便,不用自己注入,然后调用时涉及到多个表时,实例化简单 [/quote] mef依赖注入 + entity framework
-一个大坑 2019-07-02
  • 打赏
  • 举报
回复
引用 3 楼 caozhy 的回复:
好用的框架一般都是前端的。毕竟后端都是业务,业务又各不相同
主要生成model后,操作model方便,不用自己注入,然后调用时涉及到多个表时,实例化简单
threenewbee 2019-07-01
  • 打赏
  • 举报
回复
好用的框架一般都是前端的。毕竟后端都是业务,业务又各不相同
正怒月神 2019-07-01
  • 打赏
  • 举报
回复
那你用 abp试试看。 不过这个需要一点领域的概念。
-一个大坑 2019-07-01
  • 打赏
  • 举报
回复

7,765

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 非技术区
社区管理员
  • 非技术区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧