/// <summary> /// Tries to collect the views from the referenced assemblies of Entry assembly. /// </summary> /// <param name="workspace"></param> private void SerializedCollectViewsFromReferencedAssemblies(MetadataWorkspace workspace, Dictionary <EntitySetBase, GeneratedView> extentMappingViews) { ObjectItemCollection objectCollection; ItemCollection itemCollection; if (!workspace.TryGetItemCollection(DataSpace.OSpace, out itemCollection)) { //Possible enhancement : Think about achieving the same thing without creating Object Item Collection. objectCollection = new ObjectItemCollection(); itemCollection = objectCollection; // The GetEntryAssembly method can return a null reference //when a managed assembly has been loaded from an unmanaged application. Assembly entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly != null) { objectCollection.ImplicitLoadViewsFromAllReferencedAssemblies(entryAssembly); } } this.SerializedCollectViewsFromObjectCollection(workspace, extentMappingViews); }
/// <summary> /// Tries to collect the views from the referenced assemblies of Entry assembly. /// </summary> /// <param name="workspace"> </param> private void SerializedCollectViewsFromReferencedAssemblies( MetadataWorkspace workspace, Dictionary<EntitySetBase, GeneratedView> extentMappingViews) { ObjectItemCollection objectCollection; ItemCollection itemCollection; if (!workspace.TryGetItemCollection(DataSpace.OSpace, out itemCollection)) { //Possible enhancement : Think about achieving the same thing without creating Object Item Collection. objectCollection = new ObjectItemCollection(); itemCollection = objectCollection; // The GetEntryAssembly method can return a null reference //when a managed assembly has been loaded from an unmanaged application. var entryAssembly = Assembly.GetEntryAssembly(); if (entryAssembly != null) { objectCollection.ImplicitLoadViewsFromAllReferencedAssemblies(entryAssembly); } } SerializedCollectViewsFromObjectCollection(workspace, extentMappingViews); }