Exemple #1
0
        /// <summary>
        /// 创建实体
        /// </summary>
        /// <param name="saveType"></param>
        /// <returns></returns>
        public virtual DepartmentEntity CreateEntity(SaveType saveType)
        {
            var entity = new DepartmentEntity
            {
                Name     = string.IsNullOrWhiteSpace(Name) ? "" : Name,
                Sequence = Sequence == null?1: Sequence.Value,
                SaveType = saveType
            };

            if (saveType == SaveType.Modify)
            {
                entity.Id = Id.Convert <long>();
                if (Name != null)
                {
                    entity.SetProperty(it => it.Name);
                }
                if (Sequence != null)
                {
                    entity.SetProperty(it => it.Sequence);
                }
            }
            return(entity);
        }