1
//---------------------------------------------------------------------
2 // <copyright file="KnownAssemblyEntry.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
7 // @backupOwner Microsoft
8 //---------------------------------------------------------------------
10 using System
.Collections
.Generic
;
11 using System
.Reflection
;
12 using System
.Diagnostics
;
14 namespace System
.Data
.Metadata
.Edm
16 internal sealed class KnownAssemblyEntry
18 private readonly AssemblyCacheEntry _cacheEntry
;
19 private bool _referencedAssembliesAreLoaded
;
20 private bool _seenWithEdmItemCollection
;
22 internal KnownAssemblyEntry(AssemblyCacheEntry cacheEntry
, bool seenWithEdmItemCollection
)
24 Debug
.Assert(cacheEntry
!= null, "Found a null cacheEntry");
25 _cacheEntry
= cacheEntry
;
26 _referencedAssembliesAreLoaded
= false;
27 _seenWithEdmItemCollection
= seenWithEdmItemCollection
;
30 internal AssemblyCacheEntry CacheEntry
32 get { return _cacheEntry; }
35 public bool ReferencedAssembliesAreLoaded
37 get { return _referencedAssembliesAreLoaded; }
38 set { _referencedAssembliesAreLoaded = value; }
41 public bool SeenWithEdmItemCollection
43 get { return _seenWithEdmItemCollection; }
44 set { _seenWithEdmItemCollection = value; }
47 public bool HaveSeenInCompatibleContext(object loaderCookie
, EdmItemCollection itemCollection
)
49 // a new "context" is only when we have not seen this assembly with an itemCollection that is non-null
50 // and we now have a non-null itemCollection, and we are not already in AttributeLoader mode.
51 return SeenWithEdmItemCollection
||
52 itemCollection
== null ||
53 ObjectItemAssemblyLoader
.IsAttributeLoader(loaderCookie
);