CustomAssemblyResolver.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / ndp / fx / src / DataEntity / System / Data / Metadata / CustomAssemblyResolver.cs / 1 / CustomAssemblyResolver.cs

                            //---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner  [....]
//--------------------------------------------------------------------- 
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.
//---------------------------------------------------------------------- 
// 
//      Copyright (c) Microsoft Corporation.  All rights reserved.
// 
// 
// @owner  [....]
//--------------------------------------------------------------------- 
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