private void EditInternal <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited, ForeignStatus ForeignStatus) { Entity.State = Entity.State.BeginEdit(); if (Edited.EntityRelationForeignManager == null) { Entity.Data.Set(Edited.Property, Edited.Value.New); if (Edited.TrakMode.IsTrack()) { EntityChangeTracker.Track(Entity, Edited.Property); } else if (Edited.TrakMode.IsUnTrack()) { EntityChangeTracker.UnTrack(Entity, Edited.Property); } Entity.OnPropertyChanged(Edited.Property.Name); } else { Edited.EntityRelationForeignManager.UpdateOnEdit(Entity, Edited, ForeignStatus); } Entity.State = Entity.State.EndEdit(); EditInternalNotifyAllRelated(Entity); }
internal void CallBack <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited) { IEntityRelationForeignManager <TEntity> EntityRelationForeignManager = entityRelationForeignManagers[GetEntityRelation(Edited.Property)]; ForeignStatus foreignStatus = EntityRelationForeignManager.GetForeignStatus(Entity, Edited); EntityRelationForeignManager.UpdateOnEdit(Entity, Edited, foreignStatus); }
internal void Edit <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited) { EntityRelation relation = GetEntityRelation(Edited.Property); Edited.EntityRelationForeignManager = relation == null ? null : entityRelationForeignManagers[relation]; EditImp(Entity, Edited); }
private void CanEditForeign <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited, out ForeignStatus ForeignStatus) { ForeignStatus = GetForeignStatus(Entity, Edited); if (!ForeignStatus.IsValid()) { throw new EntitySetCanEditException($"{Entity} Property {Edited.Property.Name} {ForeignStatus}"); } }
private void CanEdit <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited, out ForeignStatus ForeignStatus) { if (!typeof(TEntity).Contains(Edited.Property)) { throw new CriticalException($"{Entity.GetType()} Not Contains Property {Edited.Property.Name}"); } if (Edited.Property == Key) { throw new EntitySetEditException($"Can't Edit Key Property, {Entity.GetType()}.{Edited.Property.Name}"); } ForeignStatus = ForeignStatus.Unkhown; if (Edited.EntityRelationForeignManager != null) { CanEditForeign(Entity, Edited, out ForeignStatus); } }
private ForeignStatus GetForeignStatus <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited) { return(Edited.EntityRelationForeignManager.GetForeignStatus(Entity, Edited)); }
private void EditImp <TProperty>(TEntity Entity, EditedEntity <TEntity, TProperty> Edited) { CanEdit(Entity, Edited, out ForeignStatus ForeignStatus); EditInternal(Entity, Edited, ForeignStatus); }