/// <summary> /// 转移移除的列表到当前集合中。 /// </summary> /// <param name="source"></param> void IEntitySetInternalExtension.ShiftDetachedList(IEntitySetInternalExtension source) { foreach (var item in source.GetDetachedList()) { detachedList.Add((TEntity)item); } }
private static void FillDataTableRows(DataTable table, IEntitySetInternalExtension extendList, IList <IProperty> properties, bool hasPrmKey) { FillDataTableRows(table, extendList.GetAttachedList(), properties, hasPrmKey, EntityState.Attached); FillDataTableRows(table, extendList.GetModifiedList(), properties, hasPrmKey, EntityState.Modified); FillDataTableRows(table, extendList.GetDetachedList(), properties, hasPrmKey, EntityState.Detached); extendList.Reset(); }
/// <summary> /// 检查返回的实体集的值是否为空值。 /// </summary> /// <param name="entitySet"></param> /// <param name="value"></param> /// <returns></returns> internal static PropertyValue CheckReturnEntitySetValue(IEntitySetInternalExtension entitySet, PropertyValue value) { //实体集的 SetClearFlag 为true,认为是设置为 null //var product = new Product (); //product.Orders = null; //此时可以将整个实体集清空 return(entitySet != null && entitySet.IsNeedClear ? null : value); }
private void Save(IEntitySetInternalExtension entitySet) { foreach (IEntity entity in entitySet.GetAttachedList()) { Create(entity); } foreach (IEntity entity in entitySet.GetModifiedList()) { Update(entity); } var fakePro = EntityMetadataUnity.GetEntityMetadata(entitySet.EntityType).DeleteProperty; foreach (IEntity entity in entitySet.GetDetachedList()) { Remove(entity, fakePro); } entitySet.Reset(); }