//---------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner [....]
// @backupOwner [....]
//---------------------------------------------------------------------
namespace System.Data.Metadata.Edm
{
using System.Collections.Generic;
using System.Data.Entity;
using System.Diagnostics;
using System.Reflection;
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;
}
}
}