structuremap

How to inject dependencies in WCF when the Composition Root is on the client

孤街浪徒 提交于 2020-03-16 06:33:10
问题 Before I start I must say that I maybe biting more than I can chew but I am in a desperate learning rampage and I need a lot of help. I am coding an exercise taking the samples from two books: 1. Dependency Injection in .Net by Mark Seemann 2. Professional ASP .Net Design Patterns by Brian Egan and Steve Valenzuela The exercise is implementing the Request/Response messaging pattern using WCF as the service layer AND using Dependency Injection from a Composition Root in the client application.

How to inject dependencies in WCF when the Composition Root is on the client

喜夏-厌秋 提交于 2020-03-16 06:32:08
问题 Before I start I must say that I maybe biting more than I can chew but I am in a desperate learning rampage and I need a lot of help. I am coding an exercise taking the samples from two books: 1. Dependency Injection in .Net by Mark Seemann 2. Professional ASP .Net Design Patterns by Brian Egan and Steve Valenzuela The exercise is implementing the Request/Response messaging pattern using WCF as the service layer AND using Dependency Injection from a Composition Root in the client application.

哪些.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 。 此外

StructureMap - Ability to replace an assembly at runtime

与世无争的帅哥 提交于 2020-02-08 02:42:07
问题 Example: Console application: class Program { static void Main(string[] args) { var calculator = ObjectFactory.GetInstance<ICalculator>(); for (var i = 0; i < 10; i++) { Console.WriteLine(calculator.Calculate(10, 5)); Console.ReadLine(); } Console.ReadLine(); } } Assembly "Interface": public interface ICalculator { int Calculate(int a, int b); } Assembly "Implemenation": internal class Calculator : ICalculator { public int Calculate(int a, int b) { return a + b; } } Assembly "Implemenation",

StructureMap - Ability to replace an assembly at runtime

a 夏天 提交于 2020-02-08 02:42:07
问题 Example: Console application: class Program { static void Main(string[] args) { var calculator = ObjectFactory.GetInstance<ICalculator>(); for (var i = 0; i < 10; i++) { Console.WriteLine(calculator.Calculate(10, 5)); Console.ReadLine(); } Console.ReadLine(); } } Assembly "Interface": public interface ICalculator { int Calculate(int a, int b); } Assembly "Implemenation": internal class Calculator : ICalculator { public int Calculate(int a, int b) { return a + b; } } Assembly "Implemenation",

SignalR structuremap dependency resolver ( specified for Microsoft.AspNet.SignalR.Messaging.IMessageBus )

不羁的心 提交于 2020-02-03 13:19:44
问题 how can i resolve this error ? versions Microsoft.AspNet.SignalR.Core 2.2.0, structuremap 3.1.4.143 global.asax signalR dependency resolve // SIGNALR DEPENDENCY RESOLVER GlobalHost.DependencyResolver = new StructureMapSignalRDependencyResolver(Container ?? ObjectFactory.Container); StructureMapSignalRDependencyResolver public class StructureMapSignalRDependencyResolver : DefaultDependencyResolver { private readonly IContainer _container; public StructureMapSignalRDependencyResolver(IContainer

SignalR structuremap dependency resolver ( specified for Microsoft.AspNet.SignalR.Messaging.IMessageBus )

☆樱花仙子☆ 提交于 2020-02-03 13:18:08
问题 how can i resolve this error ? versions Microsoft.AspNet.SignalR.Core 2.2.0, structuremap 3.1.4.143 global.asax signalR dependency resolve // SIGNALR DEPENDENCY RESOLVER GlobalHost.DependencyResolver = new StructureMapSignalRDependencyResolver(Container ?? ObjectFactory.Container); StructureMapSignalRDependencyResolver public class StructureMapSignalRDependencyResolver : DefaultDependencyResolver { private readonly IContainer _container; public StructureMapSignalRDependencyResolver(IContainer

How to configure ASP.NET Identity ApplicationUserManager with StructureMap

醉酒当歌 提交于 2020-01-29 04:48:05
问题 I am using asp.net identity in my project and using structuremap as DI framework. the problem is when i use constructor injection then ApplicationUserManager not configured all of it's members e.g TokenProvider, ... this is my ApplicationUserManager class: public class ApplicationUserManager : UserManager<User, long> { public ApplicationUserManager(IUserStore<User, long> store) : base(store) { } public static ApplicationUserManager Create(IdentityFactoryOptions<ApplicationUserManager> options

How can I dispose every instance object in StructureMap's ObjectFactory?

烂漫一生 提交于 2020-01-21 12:13:49
问题 I'm using StructureMap in my project and when the application finishes running I need to call the Dispose() method on all of the Singleton instances inside the ObjectFactory that implement IDisposable. I cannot find anyway to do it via the StructureMap API. Another thought I had was to get a reference to every instance and call it myself, but I cannot figure out how to loop through all of the instances. 回答1: PS: You might be interested in the deterministic disposal by Autofac IoC container

How to scan and auto-configure profiles in AutoMapper?

给你一囗甜甜゛ 提交于 2020-01-20 14:21:40
问题 Is there any way to auto-configue Automapper to scan for all profiles in namespace/assembly? What I would like to do is to add mapping profiles to AutoMapper from given assembly filtered by given interface, something like Scan Conventions in StructureMap: public static void Configure() { ObjectFactory.Initialize(x => { // Scan Assembly x.Scan( scanner => { scanner.TheCallingAssembly(); scanner.Convention<MyCustomConvention>(); scanner.WithDefaultConventions(); }); // Add Registries x