Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
 public static ICliManager CreateIdentityManager(ICliRuntimeEnvironmentInfo runtimeEnvironment)
 {
     return(new CliManager(runtimeEnvironment));
 }