ninject

开源题材征集 + MVC&EF Core 完整教程小结

守給你的承諾、 提交于 2020-04-18 05:48:41
到目前为止,我们的MVC+EF Core 完整教程的理论部分就全部结束了,共20篇,覆盖了核心的主要知识点。 下一阶段是实战部分,我们将会把这些知识点串联起来,用10篇(天)来完成一个开源项目。 现向园友征集题材,你提需求我来实现。 请在评论中提出你的需求,并加以简明扼要的描述。 题材最好是有趣的、有一定应用价值的,例如像Trello这样的效率管理系统。(可右键图片查看大图) 我将会在选取一个相对适合的题材,通过敏捷开发,快速迭代,将详细开发过程记录下来,抛砖引玉,供大家参考。 前面已完成的20篇我们以技术为主导,后面的10篇我们将会以产品为主导。 开发完之后,博主可以提供个云服务器将程序放上去给大家使用,我们可以一边玩一边改进。 主要开发环境: 1、.net core 3 最新版 2、js & jquery(如果时间允许,我们尽量多用原生js), bootstrap 3、MS SQL 2016 我们尽量只选用必要的工具,剥离表象,直达问题本质,降低大家学习成本。 让大家学会,只凭一把菜刀如何做出满汉全席。 最终的开源项目将会具有: 1、详细的使用说明书(直接放在系统中,点击帮助就能看到) 2、详细的代码说明,v1.0版本后将会托管到github上 3、详细的开发说明(代码演进),以博客园系列文章发布,了解代码演讲过程比最终的代码更有价值。 感谢写作过程中各位园友的鼓励和支持

Is Kernel.Get<T>() threadsafe + good pattern to share the kernel among components

谁说我不能喝 提交于 2020-04-08 09:41:59
问题 Is Kernel.Get() threadsafe? My goal is share an instance of my kernel among all my componenets and they may all very well call Kernel.Get() at the same time on different threads. Is Kernel.Get() thread safe? What is the best pattern to share the application kernel among all application components which are sitting in different dll's? I prefer not to pass an instance of a factory to every component of my application if this makes sense. 回答1: Get is threadsafe but creating new kernel instances

Is Kernel.Get<T>() threadsafe + good pattern to share the kernel among components

风格不统一 提交于 2020-04-08 09:39:07
问题 Is Kernel.Get() threadsafe? My goal is share an instance of my kernel among all my componenets and they may all very well call Kernel.Get() at the same time on different threads. Is Kernel.Get() thread safe? What is the best pattern to share the application kernel among all application components which are sitting in different dll's? I prefer not to pass an instance of a factory to every component of my application if this makes sense. 回答1: Get is threadsafe but creating new kernel instances

哪些.NET依赖注入框架值得研究? [关闭]

人走茶凉 提交于 2020-02-26 11:18:37
哪些C#/ .NET依赖注入框架值得研究? 你能说出他们的复杂性和速度。 #1楼 Spring.Net非常可靠,但文档需要花费一些时间才能完成。 Autofac很好,虽然支持.Net 2.0,但您需要VS 2008来编译它,否则使用命令行来构建您的应用程序。 #2楼 我使用 Simple Injector : Simple Injector是一个简单,灵活,快速的依赖注入库,它使用最佳实践指导您的解决方案走向成功的关键。 #3楼 Ninject很棒。 它看起来真的很快,但我还没有做过任何比较。 我知道作者Nate在Ninject和其他DI框架之间进行了一些比较,并且正在寻找更多方法来提高Ninject的速度。 我听说很多我尊敬的人都对StructureMap和CastleWindsor说了些好话。 在我看来,这些是现在看到的三巨头。 #4楼 我过去使用过 Spring.NET ,并且取得了很大的成功。 我从来没有注意到它有任何实质性的开销,尽管我们使用它的项目本身相当沉重。 只需花一点时间阅读 文档 即可完成设置。 #5楼 关于C#的好处在于,它遵循的是多年前Java开发人员击败的路径。 所以,我的建议,一般来说,在寻找这种性质的工具时,就是寻找可靠的Java答案,看看是否存在.NET改编。 因此,当谈到DI(并且有很多选择,这真的是一个品味问题)是 Spring.NET 。 此外

Changing default object scope with Ninject 2.2

可紊 提交于 2020-02-23 09:03:34
问题 Is it possible to change the default object scope in Ninject 2.2? If so, how is it done? 回答1: As far as I can tell you could override AddBinding() on the BindingRoot ( StandardKernel or NinjectModule ) and modify the ScopeCallback property on the binding object. public class CustomScopeKernel : StandardKernel { public CustomScopeKernel(params INinjectModule[] modules) : base(modules) { } public CustomScopeKernel( INinjectSettings settings, params INinjectModule[] modules) : base(settings,

Ninject WCF Extension ArgumentNullException using NET.TCP Binding

允我心安 提交于 2020-02-02 00:30:48
问题 I have a WCF 4 service with 2 endpoints configured to use wsHttpBinding and netTcpBinding. I am hosting the service within IIS 7.5 using WAS and am using the Ninject WCF extension to DI into my service. My service works fine when I use the wsHttpBinding endpoint to call my service but fails when I use the netTcpBinding. When I look in my Application Event Log I get the following error outlined below. I have tried debugging the problem in VS2010 but am getting nowhere fast with this. I don’t

System.Delegate System.Reflection.MethodInfo.CreateDelegate(System.Type)

 ̄綄美尐妖づ 提交于 2020-01-24 05:46:36
问题 As best as I can tell, this error has occurred in the past when Ninject is and the target for the site package are 4.x and do not match each other. I have checked on my machine and they match - both are 4.0. I did just spend some time updating all the Nu-Get packages in my project. Prior to that, this error did not occur. How can I eliminate this error? Here is my full error output: enter code here Server Error in '/' Application. Method not found: 'System.Delegate System.Reflection

WCF, async, and a confusion of context

◇◆丶佛笑我妖孽 提交于 2020-01-23 13:49:31
问题 Well, I was going to name this and a question of context , but apparently the word question isn't allowed in titles. Anyway, here's the issue: I use IErrorHandler in my WCF services in order to provide logging without cluttering up all of my service code. Until now, this has worked great. However, now that I'm trying to move to completely asynchronous services, I'm encountering the issue of the call stack being a return stack instead of a causality chain. Now, I tried using Stephen Cleary's

Inject IOwinContext with Web API and Ninject

萝らか妹 提交于 2020-01-23 05:48:08
问题 Using Web API 2 and OWIN hosting with Ninject. I would like to inject the current IOwinContext into certain services (so I can get at the Request to get the principal to do some data filtering). With Web Hosting I would, in the old days, simply have used HttpContext.Current but that is not an option with OWIN hosting (and good riddance). This SO question explains how to do it with Autofac. Essentially, you create a Dependency Scope and then, on each request, calls Autofac's Registerinstance

Ninject: entity object cannot be referenced by multiple instances of IEntityChangeTracker

ε祈祈猫儿з 提交于 2020-01-21 20:35:48
问题 I am starting to use Ninject in my MVC5 code-first app. Here's my NinjectWebCommon.cs: private static IKernel CreateKernel() { var kernel = new StandardKernel(); try { kernel.Bind<Func<IKernel>>().ToMethod(ctx => () => new Bootstrapper().Kernel); kernel.Bind<IHttpModule>().To<HttpApplicationInitializationHttpModule>(); kernel.Bind<CMSContext>() .ToSelf() //.InSingletonScope(); .InRequestScope(); kernel.Bind<IExecutiveRepository>() .To<ExecutiveRepository>(); kernel.Bind