CustomAssemblyResolver.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / DataEntity / System / Data / Metadata / CustomAssemblyResolver.cs / 1305376 / CustomAssemblyResolver.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner       [....]
// @backupOwner [....] 
//--------------------------------------------------------------------- 
using System.Diagnostics;
using System.Reflection; 
using System.Collections.Generic;
using System.Data.Entity;

namespace System.Data.Metadata.Edm 
{
    internal class CustomAssemblyResolver : MetadataArtifactAssemblyResolver 
    { 
        private Func _referenceResolver;
        private Func> _wildcardAssemblyEnumerator; 

        internal CustomAssemblyResolver(Func> wildcardAssemblyEnumerator, Func referenceResolver)
        {
            Debug.Assert(wildcardAssemblyEnumerator != null); 
            Debug.Assert(referenceResolver != null);
            _wildcardAssemblyEnumerator = wildcardAssemblyEnumerator; 
            _referenceResolver = referenceResolver; 
        }
 
        internal override bool TryResolveAssemblyReference(AssemblyName refernceName, out Assembly assembly)
        {
            assembly = _referenceResolver(refernceName);
            return assembly != null; 
        }
 
        internal override IEnumerable GetWildcardAssemblies() 
        {
            IEnumerable wildcardAssemblies = _wildcardAssemblyEnumerator(); 
            if (wildcardAssemblies == null)
            {
                throw EntityUtil.InvalidOperation(Strings.WildcardEnumeratorReturnedNull);
            } 
            return wildcardAssemblies;
 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.


                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK