Last active
November 14, 2016 19:25
-
-
Save detroitpro/d6f05342f6b9817ed3269b0a6449c957 to your computer and use it in GitHub Desktop.
PerWebRequest using external container
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Linq; | |
using System.Xml.Linq; | |
public class Register | |
{ | |
public Register(){ | |
//These two registrations provide the same functionality. | |
//ASP.NET (4.6.x) | |
container.Register(Component.For<MyEntityFrameworkContext>) | |
.ImplementedBy<MyEntityFrameworkContext>() | |
.LifestylePerWebRequest()); | |
//DotNet Core | |
container.Register(Component.For<MyEntityFrameworkContext>) | |
.ImplementedBy<MyEntityFrameworkContext>() | |
.LifestyleCustom<MsScopedLifestyleManager>()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment