System\Data\Common\Internal\Materialization\Shaper.cs (12)
29internal Shaper(DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption, int stateCount)
92public readonly MergeOption MergeOption;
139Debug.Assert(MergeOption.NoTracking != this.MergeOption, "no need to HandleEntity if there's no tracking");
140Debug.Assert(MergeOption.AppendOnly != this.MergeOption, "use HandleEntityAppendOnly instead...");
183Debug.Assert(this.MergeOption == MergeOption.AppendOnly, "only use HandleEntityAppendOnly when MergeOption is AppendOnly");
516if (forceToTrue || this.MergeOption == MergeOption.OverwriteChanges)
670(this.MergeOption == MergeOption.PreserveChanges ||
671this.MergeOption == MergeOption.OverwriteChanges))
759if (MergeOption.AppendOnly != MergeOption)
764if (MergeOption.OverwriteChanges == MergeOption)
777Debug.Assert(MergeOption.PreserveChanges == MergeOption, "not MergeOption.PreserveChanges");
1055internal Shaper(DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption, int stateCount, CoordinatorFactory<T> rootCoordinatorFactory, Action checkPermissions, bool readerOwned)
System\Data\Common\Internal\Materialization\ShaperFactory.cs (6)
25internal static ShaperFactory Create(Type elementType, QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer)
33internal abstract ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer);
39internal override ShaperFactory TypedCreate(QueryCacheManager cacheManager, ColumnMap columnMap, MetadataWorkspace metadata, SpanIndex spanInfo, MergeOption mergeOption, bool valueLayer)
54private readonly MergeOption _mergeOption;
56internal ShaperFactory(int stateCount, CoordinatorFactory<T> rootCoordinatorFactory, Action checkPermissions, MergeOption mergeOption)
67internal Shaper<T> Create(DbDataReader reader, ObjectContext context, MetadataWorkspace workspace, MergeOption mergeOption, bool readerOwned)
System\Data\Common\Internal\Materialization\Translator.cs (15)
140private readonly MergeOption _mergeOption;
181private Translator(MetadataWorkspace workspace, SpanIndex spanIndex, MergeOption mergeOption, bool valueLayer)
197internal static ShaperFactory<TRequestedType> TranslateColumnMap<TRequestedType>(QueryCacheManager queryCacheManager, ColumnMap columnMap, MetadataWorkspace workspace, SpanIndex spanIndex, MergeOption mergeOption, bool valueLayer)
743internal static Expression Emit_EnsureTypeAndWrap(Expression input, Expression keyReader, Expression entitySetReader, Type requestedType, Type identityType, Type actualType, MergeOption mergeOption, bool isProxy)
757private static Expression CreateEntityWrapper(Expression input, Expression keyReader, Expression entitySetReader, Type actualType, Type identityType, MergeOption mergeOption, bool isProxy)
769new Type[] { actualType, typeof(EntityKey), typeof(EntitySet), typeof(ObjectContext), typeof(MergeOption), typeof(Type) }, null);
770result = Expression.New(ci, input, keyReader, entitySetReader, Shaper_Context, Expression.Constant(mergeOption, typeof(MergeOption)), Expression.Constant(identityType, typeof(Type)));
795new Type[] { actualType, typeof(EntityKey), typeof(EntitySet), typeof(ObjectContext), typeof(MergeOption), typeof(Type),
797result = Expression.New(ci, input, keyReader, entitySetReader, Shaper_Context, Expression.Constant(mergeOption, typeof(MergeOption)), Expression.Constant(identityType, typeof(Type)),
1252if (MergeOption.NoTracking != _mergeOption)
1255if (typeof(IEntityWithKey).IsAssignableFrom(actualType) && MergeOption.AppendOnly != _mergeOption)
1264if (MergeOption.AppendOnly == _mergeOption)
1329_mergeOption == MergeOption.NoTracking ? MergeOption.NoTracking : MergeOption.AppendOnly, isProxy);
System\Data\Objects\DataClasses\RelatedEnd.cs (17)
276internal MergeOption DefaultMergeOption
280return UsingNoTracking ? MergeOption.NoTracking : MergeOption.AppendOnly;
327internal ObjectQuery<TEntity> CreateSourceQuery<TEntity>(MergeOption mergeOption, out bool hasResults)
666internal ObjectQuery<TEntity> ValidateLoad<TEntity>(MergeOption mergeOption, string relatedEndName, out bool hasResults)
684if (UsingNoTracking != (mergeOption == MergeOption.NoTracking))
721public abstract void Load(MergeOption mergeOption);
771internal void Merge<TEntity>(IEnumerable<TEntity> collection, MergeOption mergeOption, bool setIsLoaded)
783if (mergeOption == MergeOption.NoTracking)
794internal void Merge<TEntity>(List<IEntityWrapper> collection, MergeOption mergeOption, bool setIsLoaded)
860Merge(collection, MergeOption.OverwriteChanges, false /*setIsLoaded*/);
1165wrappedTarget.ResetContext(this.ObjectContext, GetTargetEntitySetFromRelationshipSet(), MergeOption.NoTracking);
2295internal void AttachContext(ObjectContext context, MergeOption mergeOption)
2311internal void AttachContext(ObjectContext context, EntitySet entitySet, MergeOption mergeOption)
2319if (_context == context && (_usingNoTracking == (mergeOption == MergeOption.NoTracking)))
2331this._usingNoTracking = (mergeOption == MergeOption.NoTracking);
2452this.ObjectContext.ObjectStateManager.TransactionManager.OriginalMergeOption == MergeOption.NoTracking)
System\Data\Objects\Internal\BaseEntityWrapper.cs (13)
69protected BaseEntityWrapper(TEntity entity, RelationshipManager relationshipManager, EntitySet entitySet, ObjectContext context, MergeOption mergeOption, Type identityType)
106public MergeOption MergeOption
110return (_flags & WrapperFlags.NoTracking) != 0 ? MergeOption.NoTracking : MergeOption.AppendOnly;
114Debug.Assert(value == MergeOption.AppendOnly || value == MergeOption.NoTracking, "Merge option must be one of NoTracking or AppendOnly.");
115if (value == MergeOption.NoTracking)
147public void AttachContext(ObjectContext context, EntitySet entitySet, MergeOption mergeOption)
159public void ResetContext(ObjectContext context, EntitySet entitySet, MergeOption mergeOption)
163Debug.Assert(MergeOption.NoTracking == mergeOption ||
164MergeOption.AppendOnly == mergeOption,
180Context.ObjectStateManager.TransactionManager.OriginalMergeOption == MergeOption.NoTracking)
184MergeOption = MergeOption.NoTracking;
System\Data\Objects\Internal\EntityWrapper.cs (3)
41internal EntityWrapperWithoutRelationships(TEntity entity, EntityKey key, EntitySet entitySet, ObjectContext context, MergeOption mergeOption, Type identityType,
102internal EntityWrapperWithRelationships(TEntity entity, EntityKey key, EntitySet entitySet, ObjectContext context, MergeOption mergeOption, Type identityType,
194protected EntityWrapper(TEntity entity, RelationshipManager relationshipManager, EntityKey key, EntitySet set, ObjectContext context, MergeOption mergeOption, Type identityType,
System\Data\Objects\Internal\ObjectQueryExecutionPlan.cs (4)
31internal readonly MergeOption MergeOption;
37private ObjectQueryExecutionPlan(DbCommandDefinition commandDefinition, ShaperFactory resultShaperFactory, TypeUsage resultType, MergeOption mergeOption, EntitySet singleEntitySet, CompiledQueryParameters compiledQueryParameters)
51internal static ObjectQueryExecutionPlan Prepare(ObjectContext context, DbQueryCommandTree tree, Type elementType, MergeOption mergeOption, Span span, CompiledQueryParameters compiledQueryParameters, AliasGenerator aliasGenerator)
220internal static ObjectResult<TResultType> ExecuteCommandTree<TResultType>(ObjectContext context, DbQueryCommandTree query, MergeOption mergeOption)
System\Data\Objects\ObjectContext.cs (21)
730wrappedEntity.AttachContext(this, entitySet, MergeOption.AppendOnly);
764public void LoadProperty(object entity, string navigationProperty, MergeOption mergeOption)
808public void LoadProperty<TEntity>(TEntity entity, Expression<Func<TEntity, object>> selector, MergeOption mergeOption)
1181wrappedEntity.AttachContext(this, entitySet, MergeOption.AppendOnly);
1199wrappedEntity.MergeOption != MergeOption.NoTracking)
1641ObjectQuery<T> query = new ObjectQuery<T>(queryString, this, MergeOption.AppendOnly);
2233MergeOption mergeOption = (RefreshMode.StoreWins == refreshMode ?
2234MergeOption.OverwriteChanges :
2235MergeOption.PreserveChanges);
2535ObjectResult<object> results = CreateQuery<object>(esql.ToString(), parameters).Execute(MergeOption.AppendOnly);
2559return ExecuteFunction<TElement>(functionName, MergeOption.AppendOnly, parameters);
2573public ObjectResult<TElement> ExecuteFunction<TElement>(string functionName, MergeOption mergeOption, params ObjectParameter[] parameters)
2673private ObjectResult<TElement> CreateFunctionObjectResult<TElement>(EntityCommand entityCommand, ReadOnlyMetadataCollection<EntitySet> entitySets, EdmType[] edmTypes, MergeOption mergeOption)
2702internal ObjectResult<TElement> MaterializedDataRecord<TElement>(EntityCommand entityCommand, DbDataReader storeReader, int resultSetIndex, ReadOnlyMetadataCollection<EntitySet> entitySets, EdmType[] edmTypes, MergeOption mergeOption)
2985wrappedEntity.AttachContext(this, null, MergeOption.NoTracking);
3041return ExecuteStoreQueryInternal<TElement>(commandText, null /*entitySetName*/, MergeOption.AppendOnly, parameters);
3054public ObjectResult<TEntity> ExecuteStoreQuery<TEntity>(string commandText, string entitySetName, MergeOption mergeOption, params object[] parameters)
3063private ObjectResult<TElement> ExecuteStoreQueryInternal<TElement>(string commandText, string entitySetName, MergeOption mergeOption, params object[] parameters)
3123return InternalTranslate<TElement>(reader, null /*entitySetName*/, MergeOption.AppendOnly, false);
3135public ObjectResult<TEntity> Translate<TEntity>(DbDataReader reader, string entitySetName, MergeOption mergeOption)
3152private ObjectResult<TElement> InternalTranslate<TElement>(DbDataReader reader, string entitySetName, MergeOption mergeOption, bool readerOwned)
System\Data\Objects\ObjectStateManager.cs (28)
669wrappedEntity.AttachContext(contextToAttach, (EntitySet)keyEntry.EntitySet, MergeOption.AppendOnly);
727MergeOption.AppendOnly,
802MergeOption mergeOption,
822case MergeOption.NoTracking:
828case MergeOption.AppendOnly:
842case MergeOption.PreserveChanges:
843case MergeOption.OverwriteChanges:
877if (mergeOption == MergeOption.NoTracking)
907(setIsLoaded || mergeOption == MergeOption.NoTracking)),
925private static void UpdateRelatedEnd(RelatedEnd relatedEnd, IEntityWrapper wrappedEntity, IEntityWrapper wrappedRelatedEntity, bool setIsLoaded, MergeOption mergeOption)
939if (mergeOption == MergeOption.NoTracking)
968internal static int UpdateRelationships(ObjectContext context, MergeOption mergeOption, AssociationSet associationSet, AssociationEndMember sourceMember, EntityKey sourceKey, IEntityWrapper wrappedSource, AssociationEndMember targetMember, IList targets, bool setIsLoaded)
977if (mergeOption == MergeOption.NoTracking)
999if (mergeOption == MergeOption.NoTracking)
1004MergeOption.NoTracking,
1106internal static void RemoveRelationships(ObjectContext context, MergeOption mergeOption, AssociationSet associationSet,
1109Debug.Assert(mergeOption == MergeOption.PreserveChanges || mergeOption == MergeOption.OverwriteChanges, "Unexpected MergeOption");
1115if (mergeOption == MergeOption.OverwriteChanges)
1126else if (mergeOption == MergeOption.PreserveChanges)
1163internal static bool TryUpdateExistingRelationships(ObjectContext context, MergeOption mergeOption, AssociationSet associationSet, AssociationEndMember sourceMember, EntityKey sourceKey, IEntityWrapper wrappedSource, AssociationEndMember targetMember, EntityKey targetKey, bool setIsLoaded, out EntityState newEntryState)
1165Debug.Assert(mergeOption != MergeOption.NoTracking, "Existing relationships should not be updated with NoTracking");
1215case MergeOption.AppendOnly:
1222case MergeOption.OverwriteChanges:
1230case MergeOption.PreserveChanges:
1299case MergeOption.AppendOnly:
1302case MergeOption.OverwriteChanges:
1334case MergeOption.PreserveChanges: