Created
October 14, 2013 16:22
-
-
Save lars-erik/6978254 to your computer and use it in GitHub Desktop.
Gist description…
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
protected static ServiceContext CreateServiceContext(string basePath, string connectionString, string providerName) | |
{ | |
var serviceContextManagerType = OptimisticType.GetType("Umbraco.Core.Standalone.ServiceContextManager, Umbraco.Core"); | |
if (serviceContextManagerType == null) | |
throw new Exception("Couldn't get Umbraco.Core.Standalone.ServiceContextManager type"); | |
var serviceContextManager = Activator.CreateInstance(serviceContextManagerType, | |
connectionString, | |
providerName, | |
basePath | |
); | |
var serviceContext = (ServiceContext) serviceContextManagerType.GetProperty("Services").GetValue(serviceContextManager); | |
return serviceContext; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment