public IType ObtainTypeReference(RuntimeCoreType coreType, IAssembly assembly) { Dictionary <RuntimeCoreType, IType> currentCache = null; lock (lookupCache) { CheckLUC(assembly); if (assembly != null) { currentCache = lookupCache[assembly]; lock (currentCache) { if (currentCache != null) { IType result; if (currentCache.TryGetValue(coreType, out result)) { return(result); } } } } } ICliRuntimeEnvironmentInfo runtimeEnvironmentInfo = this.runtimeEnvironment; if (assembly is ICliAssembly) { ICliAssembly cliAssembly = (ICliAssembly)assembly; if (cliAssembly.RuntimeEnvironment.Version != runtimeEnvironmentInfo.Version) { runtimeEnvironmentInfo = cliAssembly.RuntimeEnvironment; } } var resultType = this.ObtainTypeReference(runtimeEnvironmentInfo.GetCoreIdentifier(coreType), assembly); if (currentCache != null) { lock (lookupCache) lock (currentCache) currentCache.Add(coreType, resultType); } return(resultType); }
/// <summary> /// Creates a new <see cref="TypedName"/> with the /// <paramref name="name"/>, <paramref name="runtimeType"/>, <paramref name="identityManager"/>, /// <paramref name="direction"/>, and optional <paramref name="relativeSource"/>. /// </summary> /// <param name="name">The <see cref="System.String"/> /// which relates to the name of the <see cref="TypedName"/>.</param> /// <param name="runtimeType">The <see cref="RuntimeCoreType"/> relative to the /// identity of the type to retrieve from the <paramref name="identityManager"/>.</param> /// <param name="identityManager">The <see cref="IIdentityManager"/> responsible for /// disambiguating the <paramref name="runtimeType"/>.</param> /// <param name="direction">The <see cref="ParameterCoercionDirection"/> /// which indicates how the type should be directed.</param> /// <param name="relativeSource">The <see cref="IAssembly"/> relative to the /// <paramref name="runtimeType"/> used for context, which either contains the type /// or references the assembly containing the type.</param> public TypedName(string name, RuntimeCoreType runtimeType, IIdentityManager identityManager, ParameterCoercionDirection direction, IAssembly relativeSource = null) : this(name, identityManager.ObtainTypeReference(runtimeType, relativeSource), direction) { }
/// <summary> /// Creates a new <see cref="TypedName"/> with the /// <paramref name="name"/>, <paramref name="runtimeType"/>, <paramref name="identityManager"/> /// and optional <paramref name="relativeSource"/>. /// </summary> /// <param name="name">The <see cref="System.String"/> /// which relates to the name of the <see cref="TypedName"/>.</param> /// <param name="runtimeType">The <see cref="RuntimeCoreType"/> relative to the /// identity of the type to retrieve from the <paramref name="identityManager"/>.</param> /// <param name="identityManager">The <see cref="IIdentityManager"/> responsible for /// disambiguating the <paramref name="runtimeType"/>.</param> /// <param name="relativeSource">The <see cref="IAssembly"/> relative to the /// <paramref name="runtimeType"/> used for context, which either contains the type /// or references the assembly containing the type.</param> public TypedName(string name, RuntimeCoreType runtimeType, IIdentityManager identityManager, IAssembly relativeSource = null) : this(name, identityManager.ObtainTypeReference(runtimeType, relativeSource)) { }
public IType ObtainTypeReference(RuntimeCoreType coreType) { return(this.ObtainTypeReference(this.RuntimeEnvironment.GetCoreIdentifier(coreType))); }