Ejemplo n.º 1
0
        /// <summary>
        /// 批量导入指定的实体或列表。
        /// </summary>
        /// <param name="entityOrList"></param>
        public void Save(IDomainComponent entityOrList)
        {
            if (entityOrList == null) throw new ArgumentNullException("entityOrList");
            _entityOrList = entityOrList;

            this.Invoke();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 把这个组件中的所有改动保存到仓库中。
        ///
        /// <remarks>
        /// * 当本地保存时,方法返回的就是传入的实体。
        /// * 当客户端保存时,方法返回的是服务端保存后并向客户端回传的实体。
        ///     此时,会对传入的实体或列表进行融合 Id 的操作。
        ///     也就是说,在服务端生成的所有 Id 都会设置到参数实体中。
        ///     而服务端设置其它的属性则会被忽略,如果想要使用其它的属性,则可以从返回值中获取。
        ///
        /// 在客户端调用本方法保存实体的同时,服务端会把服务端保存完毕后的实体数据传输回客户端,这样才能保证客户端的实体能获取服务端生成的 Id 数据。
        /// 如果希望不进行如何大数据量的传输,则尽量不要在客户端直接调用 Save 来进行实体的保存。(例如可以通过 Service 来定义数据的传输。)
        /// </remarks>
        /// </summary>
        /// <param name="component">需要保存的组件,可以是一个实体,也可以是一个实体列表。</param>
        /// <returns>
        /// 返回在仓库中保存后的实体。
        /// </returns>
        public IDomainComponent Save(IDomainComponent component)
        {
            IDomainComponent result = component;

            if (component.IsDirty)
            {
                this.OnSaving(component);

                if (component is Entity)
                {
                    var entity = component as Entity;

                    var entityServer = this.SaveToPortal(component) as Entity;

                    //如果返回的对象与传入的对象不是同一个对象,表示已经在客户端通过了 WCF 来进行传输,
                    //这时需要把客户端对象的 Id 值与服务器对象的 Id 值统一。
                    if (entity != entityServer)
                    {
                        if (HasNewEntity(entity))
                        {
                            MergeIdRecur(entity, entityServer as Entity);
                        }

                        result = entityServer;
                    }
                }
                else if (component is EntityList)
                {
                    var list = component as EntityList;

                    var listServer = this.SaveToPortal(component) as EntityList;

                    if (list != listServer)
                    {
                        //保存实体列表时,需要把所有新加的实体的 Id 都设置好。
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (HasNewEntity(list[i]))
                            {
                                MergeIdRecur(list[i], listServer[i]);
                            }
                        }

                        result = listServer;
                    }
                }
                else
                {
                    throw new NotSupportedException("只支持对 Entity、EntityList 进行保存。");
                }
            }

            //this.OnSaved(new SavedArgs
            //{
            //    Component = component,
            //    ReturnedComponent = result
            //});

            return(result);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 完整提交指定的领域实体或领域实体列表。
 /// </summary>
 /// <param name="component"></param>
 /// <param name="markSaved">如果是最外层调用此方法,则在最终标记整个组件为保存完毕。</param>
 private void SubmitComponent(IDomainComponent component, bool markSaved)
 {
     //对于树的列表的提交,需要单独处理
     if (_repository.SupportTree)
     {
         if (component is Entity)
         {
             this.SubmitTree(component as Entity, markSaved);
         }
         else
         {
             this.SubmitTreeList(component as EntityList, markSaved);
         }
     }
     else
     {
         if (component is Entity)
         {
             this.SubmitItem(component as Entity, markSaved, false);
         }
         else
         {
             this.SubmitList(component as EntityList, markSaved);
         }
     }
 }
Ejemplo n.º 4
0
 protected virtual void OnDataChanging(IDomainComponent oldValue, IDomainComponent newValue)
 {
     foreach (var r in this._relations)
     {
         r.OnOwnerDataChanging(oldValue, newValue);
     }
 }
Ejemplo n.º 5
0
 /// <summary>
 /// 序列化指定的实体元素,并返回对应的 JSON。
 /// </summary>
 /// <param name="entityOrList"></param>
 /// <returns></returns>
 public string Serialize(IDomainComponent entityOrList)
 {
     using (var writer = new StringWriter())
     {
         this.Serialize(entityOrList, writer);
         return(writer.ToString());
     }
 }
Ejemplo n.º 6
0
        private static void SaveRecur(IDomainComponent child, Entity parent)
        {
            //使用组合子自己的仓库来进行提交。
            var childDataProvider = child.GetRepository().DataProvider as IRepositoryDataProviderInternal;
            var childSaver        = childDataProvider.DataSaver;

            childSaver.SubmitChildrenComponent(child, parent);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// 提交更新指定实体的组合子列表。
        /// </summary>
        /// <param name="child">The child.</param>
        /// <param name="parent">The parent.</param>
        private void SubmitChildrenComponent(IDomainComponent child, Entity parent)
        {
            if (child.IsDirty)
            {
                _repository.ClientCache.UpdateServerVersion(parent);

                this.SubmitComponent(child, false);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 为指定的根实体构造一个读取器
        /// </summary>
        /// <param name="entityOrList">The entity or list.</param>
        /// <exception cref="System.ArgumentNullException">entityOrList</exception>
        internal EntityBatchReader(IDomainComponent entityOrList)
        {
            if (entityOrList == null)
            {
                throw new ArgumentNullException("entityOrList");
            }

            this._entityOrList = entityOrList;
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 批量导入指定的实体或列表。
        /// </summary>
        /// <param name="entityOrList"></param>
        public void Save(IDomainComponent entityOrList)
        {
            if (entityOrList == null)
            {
                throw new ArgumentNullException("entityOrList");
            }
            _entityOrList = entityOrList;

            this.Invoke();
        }
Ejemplo n.º 10
0
        private void SerializeAggt(IDomainComponent value, JsonTextWriter jw)
        {
            var serializer = new AggtSerializer();

            serializer.UseCamelProperty = this.SerializeAsCamelProperty;
            if (this.SerializerConfiguration != null)
            {
                this.SerializerConfiguration(serializer);
            }
            serializer.Serialize(value, jw);
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 数据门户调用本接口来保存数据。
        /// </summary>
        /// <param name="component"></param>
        internal protected virtual void SubmitComposition(IDomainComponent component)
        {
            //在更新时,通知服务器更新数据版本号,并使用批量更新来提升更新的性能。
            using (VersionSyncMgr.BatchSaveScope())
            {
                //从数据门户过来的更新时,一般都是根实体时,这时需要同时更新整张表的服务端缓存版本号。
                //如果不是根实体,那也无法获取这个数据的版本号范围,所以也简单地更新整张表的版本号。
                _repository.ClientCache.UpdateServerVersion();

                this.SubmitComponent(component, true);
            }
        }
Ejemplo n.º 12
0
        internal protected override void SubmitComposition(IDomainComponent component)
        {
            //以下事务代码,不需要区分是否使用分布式缓存的情况来做事务处理,
            //而是直接使用 SingleConnectionTransactionScope 类来管理不同数据库的事务,
            //因为这个类会保证不同的库使用不同的事务。
            using (var tran = new SingleConnectionTrasactionScope(_dataProvider.DbSetting))
            {
                base.SubmitComposition(component);

                //最后提交事务。前面的代码,如果出现异常,则会回滚整个事务。
                tran.Complete();
            }
        }
Ejemplo n.º 13
0
        protected internal override void SubmitComposition(IDomainComponent component)
        {
            //以下事务代码,不需要区分是否使用分布式缓存的情况来做事务处理,
            //而是直接使用 SingleConnectionTransactionScope 类来管理不同数据库的事务,
            //因为这个类会保证不同的库使用不同的事务。
            using (var tran = new SingleConnectionTrasactionScope(_dataProvider.DbSetting))
            {
                base.SubmitComposition(component);

                //最后提交事务。前面的代码,如果出现异常,则会回滚整个事务。
                tran.Complete();
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// 序列化指定的实体元素到指定的 TextWriter 中。
        /// </summary>
        /// <param name="entityOrList"></param>
        /// <param name="textWriter"></param>
        public void Serialize(IDomainComponent entityOrList, TextWriter textWriter)
        {
            using (_writer = new JsonTextWriter(textWriter))
            {
                _writer.CloseOutput = false;
                if (this.Indent)
                {
                    _writer.Formatting = Formatting.Indented;
                }

                this.Serialize(entityOrList, _writer);

                _writer.Flush();
            }
        }
Ejemplo n.º 15
0
        protected override void OnDataChanging(IDomainComponent oldValue, IDomainComponent newValue)
        {
            var oldEntity = oldValue as Entity;

            if (oldEntity != null)
            {
                oldEntity.PropertyChanged -= Current_PropertyChanged;
            }

            if (newValue is EntityList)
            {
                throw new InvalidOperationException("详细面板的全部数据只支持设置为单一实体。");
            }

            base.OnDataChanging(oldValue, newValue);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 序列化指定的实体元素到指定的 JsonTextWriter 中。
        /// </summary>
        /// <param name="entityOrList">The entity or list.</param>
        /// <param name="jsonWriter">The json writer.</param>
        /// <exception cref="System.ArgumentNullException">jsonWriter</exception>
        public void Serialize(IDomainComponent entityOrList, JsonTextWriter jsonWriter)
        {
            if (jsonWriter == null)
            {
                throw new ArgumentNullException("jsonWriter");
            }

            _writer = jsonWriter;

            if (entityOrList is Entity)
            {
                this.SerializeEntity(entityOrList as Entity);
            }
            else
            {
                this.SerializeList(entityOrList as EntityList);
            }
        }
Ejemplo n.º 17
0
        /// <summary>
        /// 把这个组件中的所有改动保存到仓库中。
        ///
        /// <remarks>
        /// * 当本地保存时,方法返回的就是传入的实体。
        /// * 当客户端保存时,方法返回的是服务端保存后并向客户端回传的实体。
        ///     此时,会对传入的实体或列表进行融合 Id 的操作。
        ///     也就是说,在服务端生成的所有 Id 都会设置到参数实体中。
        ///     而服务端设置其它的属性则会被忽略,如果想要使用其它的属性,则可以从返回值中获取。
        ///
        /// 在客户端调用本方法保存实体的同时,服务端会把服务端保存完毕后的实体数据传输回客户端,这样才能保证客户端的实体能获取服务端生成的 Id 数据。
        /// 如果希望不进行如何大数据量的传输,则尽量不要在客户端直接调用 Save 来进行实体的保存。(例如可以通过 Service 来定义数据的传输。)
        /// </remarks>
        /// </summary>
        /// <param name="component">需要保存的组件,可以是一个实体,也可以是一个实体列表。</param>
        /// <returns>
        /// 返回在仓库中保存后的实体。
        /// 如果是远程保存,则返回的是远程服务的返回对象,而非传入的对象。
        /// </returns>
        public virtual IDomainComponent Save(IDomainComponent component)
        {
            IDomainComponent result = component;

            if (component.IsDirty)
            {
                this.OnSaving(component);

                result = this.SaveToPortal(component);

                //如果返回的对象与传入的对象不是同一个对象,表示已经通过了 WCF 来进行进行传输,
                //这时需要把客户端对象的 Id 值与服务器对象的 Id 值统一。
                if (component != result)
                {
                    var mergeCloneOptions = new CloneOptions(
                        CloneActions.IdProperty |       //数据库生成的 Id,需要合并
                        CloneActions.NormalProperties | //TreePId、ParentEntityId 以及一些数据库生成的时间等属性,都需要合并
                        CloneActions.RefEntities |      //实体引用,可有可无
                        CloneActions.ChildrenRecur      //递归拷贝
                        );

                    if (component is Entity)
                    {
                        (component as Entity).Clone(result as Entity, mergeCloneOptions);
                    }
                    else if (component is EntityList)
                    {
                        (component as EntityList).Clone(result as EntityList, mergeCloneOptions);
                    }
                    else
                    {
                        throw new NotSupportedException("只支持对 Entity、EntityList 进行保存。");
                    }
                }

                //this.OnSaved(new SavedArgs
                //{
                //    Component = component,
                //    ReturnedComponent = result
                //});
            }

            return(result);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 数据门户调用本接口来保存数据。
        /// </summary>
        /// <param name="component"></param>
        public virtual void SubmitComposition(IDomainComponent component)
        {
            //以下事务代码,不需要区分是否使用分布式缓存的情况来做事务处理,
            //而是直接使用 SingleConnectionTransactionScope 类来管理不同数据库的事务,
            //因为这个类会保证不同的库使用不同的事务。
            using (var tran = new SingleConnectionTrasactionScope(this.DbSetting))
            {
                //在更新时,通知服务器更新数据版本号,并使用批量更新来提升更新的性能。
                using (VersionSyncMgr.BatchSaveScope())
                {
                    //从数据门户过来的更新时,一般都是根实体时,这时需要同时更新整张表的服务端缓存版本号。
                    //如果不是根实体,那也无法获取这个数据的版本号范围,所以也简单地更新整张表的版本号。
                    _repository.ClientCache.UpdateServerVersion();

                    this.SubmitComponent(component, true);
                }

                //最后提交事务。前面的代码,如果出现异常,则会回滚整个事务。
                tran.Complete();
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 序列化指定的实体元素到指定的 TextWriter 中。
        /// </summary>
        /// <param name="entityOrList"></param>
        /// <param name="textWriter"></param>
        public void Serialize(IDomainComponent entityOrList, TextWriter textWriter)
        {
            using (_writer = new JsonTextWriter(textWriter))
            {
                _writer.CloseOutput = false;
                if (this.Indent)
                {
                    _writer.Formatting = Formatting.Indented;
                }

                if (entityOrList is Entity)
                {
                    this.SerializeEntity(entityOrList as Entity);
                }
                else
                {
                    this.SerializeList(entityOrList as EntityList);
                }

                _writer.Flush();
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// 数据门户调用本接口来保存数据。
 /// </summary>
 /// <param name="component"></param>
 internal void SubmitComposition(IDomainComponent component)
 {
     this.DataSaver.SubmitComposition(component);
 }
Ejemplo n.º 21
0
 /// <summary>
 /// 为报表添加指定的数据源。
 /// </summary>
 /// <param name="dataSourceName">对应在报表中的数据源名称</param>
 /// <param name="data">实体数据。</param>
 public void AddReportDataSource(string dataSourceName, IDomainComponent data)
 {
     this._customDataSources[dataSourceName] = data;
 }
Ejemplo n.º 22
0
 public DataLoadedEventArgs(IDomainComponent data)
 {
     this._data = data;
 }
Ejemplo n.º 23
0
        /// <summary>
        /// 数据门户调用本接口来保存数据。
        /// </summary>
        /// <param name="component"></param>
        protected internal virtual void SubmitComposition(IDomainComponent component)
        {
            //在更新时,通知服务器更新数据版本号,并使用批量更新来提升更新的性能。
            using (VersionSyncMgr.BatchSaveScope())
            {
                //从数据门户过来的更新时,一般都是根实体时,这时需要同时更新整张表的服务端缓存版本号。
                //如果不是根实体,那也无法获取这个数据的版本号范围,所以也简单地更新整张表的版本号。
                _repository.ClientCache.UpdateServerVersion();

                this.SubmitComponent(component, true);
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// 序列化指定的实体元素到指定的 TextWriter 中。
        /// </summary>
        /// <param name="entityOrList"></param>
        /// <param name="textWriter"></param>
        public void Serialize(IDomainComponent entityOrList, TextWriter textWriter)
        {
            using (_writer = new JsonTextWriter(textWriter))
            {
                _writer.CloseOutput = false;
                if (this.Indent)
                {
                    _writer.Formatting = Formatting.Indented;
                }

                this.Serialize(entityOrList, _writer);

                _writer.Flush();
            }
        }
Ejemplo n.º 25
0
 private static void SaveRecur(IDomainComponent child, Entity parent)
 {
     //使用组合子自己的仓库来进行提交。
     var childDataProvider = child.GetRepository().DataProvider as IRepositoryDataProviderInternal;
     var childSaver = childDataProvider.DataSaver;
     childSaver.SubmitChildrenComponent(child, parent);
 }
Ejemplo n.º 26
0
        /// <summary>
        /// 把这个组件中的所有改动保存到仓库中。
        /// 
        /// <remarks>
        /// * 当本地保存时,方法返回的就是传入的实体。
        /// * 当客户端保存时,方法返回的是服务端保存后并向客户端回传的实体。
        ///     此时,会对传入的实体或列表进行融合 Id 的操作。
        ///     也就是说,在服务端生成的所有 Id 都会设置到参数实体中。
        ///     而服务端设置其它的属性则会被忽略,如果想要使用其它的属性,则可以从返回值中获取。
        ///     
        /// 在客户端调用本方法保存实体的同时,服务端会把服务端保存完毕后的实体数据传输回客户端,这样才能保证客户端的实体能获取服务端生成的 Id 数据。
        /// 如果希望不进行如何大数据量的传输,则尽量不要在客户端直接调用 Save 来进行实体的保存。(例如可以通过 Service 来定义数据的传输。)
        /// </remarks>
        /// </summary>
        /// <param name="component">需要保存的组件,可以是一个实体,也可以是一个实体列表。</param>
        /// <returns>
        /// 返回在仓库中保存后的实体。
        /// </returns>
        public IDomainComponent Save(IDomainComponent component)
        {
            IDomainComponent result = component;

            if (component.IsDirty)
            {
                this.OnSaving(component);

                if (component is Entity)
                {
                    var entity = component as Entity;

                    var entityServer = this.SaveToPortal(component) as Entity;

                    //如果返回的对象与传入的对象不是同一个对象,表示已经在客户端通过了 WCF 来进行传输,
                    //这时需要把客户端对象的 Id 值与服务器对象的 Id 值统一。
                    if (entity != entityServer)
                    {
                        if (HasNewEntity(entity))
                        {
                            MergeIdRecur(entity, entityServer as Entity);
                        }

                        result = entityServer;
                    }
                }
                else if (component is EntityList)
                {
                    var list = component as EntityList;

                    var listServer = this.SaveToPortal(component) as EntityList;

                    if (list != listServer)
                    {
                        //保存实体列表时,需要把所有新加的实体的 Id 都设置好。
                        for (int i = 0; i < list.Count; i++)
                        {
                            if (HasNewEntity(list[i]))
                            {
                                MergeIdRecur(list[i], listServer[i]);
                            }
                        }

                        result = listServer;
                    }
                }
                else
                {
                    throw new NotSupportedException("只支持对 Entity、EntityList 进行保存。");
                }

                //保存结束,传入的组件需要标记为
                component.MarkSaved();
            }

            //this.OnSaved(new SavedArgs
            //{
            //    Component = component,
            //    ReturnedComponent = result
            //});

            return result;
        }
Ejemplo n.º 27
0
 public ChildPropertyField(IProperty property, IDomainComponent value)
 {
     _property = property;
     _value = value;
 }
 public void SaveToHistory(IDomainComponent component)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 29
0
        /// <summary>
        /// 为指定的根实体构造一个读取器
        /// </summary>
        /// <param name="entityOrList">The entity or list.</param>
        /// <exception cref="System.ArgumentNullException">entityOrList</exception>
        internal EntityBatchReader(IDomainComponent entityOrList)
        {
            if (entityOrList == null) throw new ArgumentNullException("entityOrList");

            this._entityOrList = entityOrList;
        }
        /// <summary>
        /// 使用指定的 JsonTextWriter 来序列化 <see cref="IDomainComponent"/> 类型。
        /// </summary>
        /// <param name="value"></param>
        /// <param name="jw"></param>
        protected virtual void SerializeDomainComponent(IDomainComponent value, JsonTextWriter jw)
        {
            var serializer = this.CreateSerializer();

            serializer.Serialize(value, jw);
        }
Ejemplo n.º 31
0
 /// <summary>
 /// 通过门户来保存指定的实体类/列表。
 ///
 /// 所有使用 Save 方法保存的实体,都会通过这个方法来选择是分布式保存、还是直接保存。
 /// 此方法是仓库接口门户层的最后一个方法,之后将会在服务端(如果是分布式)发布 Submit 数据提交操作。
 /// </summary>
 /// <param name="component"></param>
 /// <returns></returns>
 private IDomainComponent SaveToPortal(IDomainComponent component)
 {
     return(DataPortalApi.Update(component, this.DataPortalLocation) as IDomainComponent);
 }
Ejemplo n.º 32
0
 public DataLoadedEventArgs(IDomainComponent data)
 {
     this._data = data;
 }
Ejemplo n.º 33
0
 void IDomainComponent.SetParent(IDomainComponent parent)
 {
     _parent = parent;
 }
Ejemplo n.º 34
0
 /// <summary>
 /// 通过门户来保存指定的实体类/列表。
 /// 
 /// 所有使用 Save 方法保存的实体,都会通过这个方法来选择是分布式保存、还是直接保存。
 /// 此方法是仓库接口门户层的最后一个方法,之后将会在服务端(如果是分布式)发布 Submit 数据提交操作。
 /// </summary>
 /// <param name="component"></param>
 /// <returns></returns>
 private IDomainComponent SaveToPortal(IDomainComponent component)
 {
     return DataPortalApi.Update(component, this.DataPortalLocation) as IDomainComponent;
 }
Ejemplo n.º 35
0
 internal void DisconnectFromParent()
 {
     _parent = null;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// 在使用 Save 方法保存实体数据时,进入数据门户前,Rafy 会调用此方法。
 /// <remarks>
 /// 子类可重写此方法实现一些仓库保存前的检查。
 /// 例如,一些仓库只允许在客户端进行调用时,可以在方法中判断,如果当前处在服务端,则抛出异常的逻辑。
 /// </remarks>
 /// </summary>
 /// <param name="component"></param>
 protected virtual void OnSaving(IDomainComponent component)
 {
 }
Ejemplo n.º 37
0
 /// <summary>
 /// 序列化指定的实体元素,并返回对应的 JSON。
 /// </summary>
 /// <param name="entityOrList"></param>
 /// <returns></returns>
 public string Serialize(IDomainComponent entityOrList)
 {
     using (var writer = new StringWriter())
     {
         this.Serialize(entityOrList, writer);
         return writer.ToString();
     }
 }
Ejemplo n.º 38
0
 public ChildPropertyField(IProperty property, IDomainComponent value)
 {
     _property = property;
     _value    = value;
 }
Ejemplo n.º 39
0
        /// <summary>
        /// 序列化指定的实体元素到指定的 JsonTextWriter 中。
        /// </summary>
        /// <param name="entityOrList">The entity or list.</param>
        /// <param name="jsonWriter">The json writer.</param>
        /// <exception cref="System.ArgumentNullException">jsonWriter</exception>
        public void Serialize(IDomainComponent entityOrList, JsonTextWriter jsonWriter)
        {
            if (jsonWriter == null) throw new ArgumentNullException("jsonWriter");

            _writer = jsonWriter;

            if (entityOrList is Entity)
            {
                this.SerializeEntity(entityOrList as Entity);
            }
            else
            {
                this.SerializeList(entityOrList as EntityList);
            }
        }
Ejemplo n.º 40
0
 internal void DisconnectFromParent()
 {
     _parent = null;
 }
Ejemplo n.º 41
0
 /// <summary>
 /// 数据门户调用本接口来保存数据。
 /// </summary>
 /// <param name="component"></param>
 internal void SubmitComposition(IDomainComponent component)
 {
     this.DataSaver.SubmitComposition(component);
 }
Ejemplo n.º 42
0
 /// <summary>
 /// 完整提交指定的领域实体或领域实体列表。
 /// </summary>
 /// <param name="component"></param>
 /// <param name="markSaved">如果是最外层调用此方法,则在最终标记整个组件为保存完毕。</param>
 private void SubmitComponent(IDomainComponent component, bool markSaved)
 {
     //对于树的列表的提交,需要单独处理
     if (_repository.SupportTree)
     {
         if (component is Entity)
         {
             this.SubmitTree(component as Entity, markSaved);
         }
         else
         {
             this.SubmitTreeList(component as EntityList, markSaved);
         }
     }
     else
     {
         if (component is Entity)
         {
             this.SubmitItem(component as Entity, markSaved, false);
         }
         else
         {
             this.SubmitList(component as EntityList, markSaved);
         }
     }
 }
Ejemplo n.º 43
0
 void IDomainComponent.SetParent(IDomainComponent parent)
 {
     this._parent = parent;
 }
Ejemplo n.º 44
0
        /// <summary>
        /// 提交更新指定实体的组合子列表。
        /// </summary>
        /// <param name="child">The child.</param>
        /// <param name="parent">The parent.</param>
        private void SubmitChildrenComponent(IDomainComponent child, Entity parent)
        {
            if (child.IsDirty)
            {
                _repository.ClientCache.UpdateServerVersion(parent);

                this.SubmitComponent(child, false);
            }
        }
Ejemplo n.º 45
0
        protected override void OnDataChanging(IDomainComponent oldValue, IDomainComponent newValue)
        {
            var oldEntity = oldValue as Entity;
            if (oldEntity != null)
            {
                oldEntity.PropertyChanged -= Current_PropertyChanged;
            }

            if (newValue is EntityList)
            {
                throw new InvalidOperationException("详细面板的全部数据只支持设置为单一实体。");
            }

            base.OnDataChanging(oldValue, newValue);
        }
Ejemplo n.º 46
0
 public void SetComponent(IDomainComponent component)
 {
     this.component = component;
 }
Ejemplo n.º 47
0
 protected internal virtual void OnOwnerDataChanging(IDomainComponent oldValue, IDomainComponent newValue)
 {
 }
Ejemplo n.º 48
0
 /// <summary>
 /// 在使用 Save 方法保存实体数据时,进入数据门户前,Rafy 会调用此方法。
 /// <remarks>
 /// 子类可重写此方法实现一些仓库保存前的检查。
 /// 例如,一些仓库只允许在客户端进行调用时,可以在方法中判断,如果当前处在服务端,则抛出异常的逻辑。
 /// </remarks>
 /// </summary>
 /// <param name="component"></param>
 protected virtual void OnSaving(IDomainComponent component)
 {
 }
Ejemplo n.º 49
0
 /// <summary>
 /// 为报表添加指定的数据源。
 /// </summary>
 /// <param name="dataSourceName">对应在报表中的数据源名称</param>
 /// <param name="data">实体数据。</param>
 public void AddReportDataSource(string dataSourceName, IDomainComponent data)
 {
     this._customDataSources[dataSourceName] = data;
 }
Ejemplo n.º 50
0
 internal protected virtual void OnOwnerDataChanging(IDomainComponent oldValue, IDomainComponent newValue)
 {
 }