/// <summary> /// Constructor for a readonly entity set. <br /> /// Calls to Add, Delete, Attach, AttachAsModified, and Detach will throw exceptions. /// </summary> public EntitySet(IDataContext dataContext, InternalEntitySet <TEntity> entitySet, DataContext.AttachDelegate <TEntity> attachDelegate, DataContext.DetachDelegate <TEntity> detachDelegate, DataContext.QueryDelegate <TEntity> queryDelegate) { this._dataContext = dataContext; this._internalEntitySet = entitySet; this._attachDelegate = attachDelegate; this._detachDelegate = detachDelegate; this._queryDelegate = queryDelegate; }
protected InternalEntitySet <TEntity> CreateAndRegisterInternalEntitySet <TEntity>() where TEntity : Entity { var entitySet = new InternalEntitySet <TEntity>(); _entitySets.Add(entitySet); entitySet.PropertyChanged += (s, e) => { switch (e.PropertyName) { case "HasChanges": if (SuppressHasChanges) { return; } OnPropertyChanged("HasChanges"); break; } }; return(entitySet); }
protected virtual IEntitySet <TEntity> CreateEntitySet <TEntity>(InternalEntitySet <TEntity> entitySet, AttachDelegate <TEntity> attachDelegate, DetachDelegate <TEntity> detachDelegate, QueryDelegate <TEntity> queryDelegate) where TEntity : Entity { return(new EntitySet <TEntity>(this, entitySet, attachDelegate, detachDelegate, queryDelegate)); }