src/Shared/EntityFramework/Core/Objects/DataClasses/EntityCollection.cs
// <summary>
// Requires: collection is null or contains related entities.
// Loads related entities into the local collection.
// </summary>
// <param name="collection"> If null, retrieves entities from the server through a query; otherwise, loads the given collection </param>
collection is null or contains related entities.
Loads related entities into the local collection.
collection is null or contains related entities . Loads related entities into the local collection .
internal virtual void Load(List<IEntityWrapper> collection, MergeOption mergeOption)
        {
            bool hasResults;
            var sourceQuery = ValidateLoad<TEntity>(mergeOption, "EntityCollection", out hasResults);
            _suppressEvents = true;
            try
            {
                if (collection == null)
                {
                    IEnumerable<TEntity> refreshedValues;
                    if (hasResults)
                    {
                        refreshedValues = sourceQuery.Execute(sourceQuery.MergeOption);
                    }
                    else
                    {
                        refreshedValues = Enumerable.Empty<TEntity>();
                    }
                    Merge(refreshedValues, mergeOption, true );
                }
                else
                {
                    Merge<TEntity>(collection, mergeOption, true );
                }
            }
            finally
            {
                _suppressEvents = false;
            }
            OnAssociationChanged(CollectionChangeAction.Refresh, null);
        }
internal virtual void Load ( List < IEntityWrapper > collection , MergeOption mergeOption ) { bool hasResults ; var sourceQuery = ValidateLoad < TEntity > ( mergeOption , " " , out hasResults ) ; _suppressEvents = true ; try { if ( collection == null ) { IEnumerable < TEntity > refreshedValues ; if ( hasResults ) { refreshedValues = sourceQuery . Execute ( sourceQuery . MergeOption ) ; } else { refreshedValues = Enumerable . Empty < TEntity > ( ) ; } Merge ( refreshedValues , mergeOption , true ) ; } else { Merge < TEntity > ( collection , mergeOption , true ) ; } } finally { _suppressEvents = false ; } OnAssociationChanged ( CollectionChangeAction . Refresh , null ) ; }
Requires: collection is null or contains related entities.
Requires : collection is null or contains related entities .
// Validate that the Load is possible // we do not want any Add or Remove event to be fired during Merge, we will fire a Refresh event at the end if everything is successful /*setIsLoaded*/ /*setIsLoaded*/ // fire the AssociationChange with Refresh
collection
List<IEntityWrapper>
If null, retrieves entities from the server through a query; otherwise, loads the given collection
If null retrieves entities from the server through a query ; otherwise loads the given collection
mergeOption
MergeOption