Created
September 30, 2011 02:06
-
-
Save jbogard/1252482 to your computer and use it in GitHub Desktop.
Conditional crazy
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
object IMappingEngineRunner.CreateObject(ResolutionContext context) | |
{ | |
var typeMap = context.TypeMap; | |
var destinationType = context.DestinationType; | |
if (typeMap != null) | |
if (typeMap.DestinationCtor != null) | |
return typeMap.DestinationCtor(context.SourceValue); | |
else if (typeMap.ConstructDestinationUsingServiceLocator && context.Options.ServiceCtor != null) | |
return context.Options.ServiceCtor(destinationType); | |
else if (typeMap.ConstructDestinationUsingServiceLocator) | |
return _configurationProvider.ServiceCtor(destinationType); | |
else if (typeMap.ConstructorMap != null) | |
return typeMap.ConstructorMap.ResolveValue(context); | |
if (context.DestinationValue != null) | |
return context.DestinationValue; | |
if (destinationType.IsInterface) | |
destinationType = ProxyGenerator.GetProxyType(destinationType); | |
return ObjectCreator.CreateObject(destinationType); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment