Example #1
0
        protected override void Execute()
        {
            var em = ClientEntities.Find(ClientEntity);

            if (em != null)
            {
                var evm = UIModel.Views.CreateBaseView(em.EntityType);
                Label = evm.Label;
            }
        }
Example #2
0
        protected override void Execute()
        {
            if (!RafyEnvironment.Location.IsWebUI)
            {
                throw new InvalidOperationException("此命令只在 Web 模式下可用。");
            }

            var entityType = ClientEntities.Find(this.EntityType).EntityType;

            this.code = RF.Concrete <AutoCodeInfoRepository>().GetOrCreateAutoCode(entityType);
        }
Example #3
0
        public virtual ViewConfigurationModel GetBy(ViewConfigurationModelNameCriteria criteria)
        {
            Type entityType = ClientEntities.Find(criteria.EntityType).EntityType;

            var evm = UIModel.Views.Create(entityType, criteria.ViewName);

            var m = new ViewConfigurationModel();

            m.Read(evm);
            (m as IDirtyAware).MarkSaved();

            return(m);
        }
Example #4
0
        protected BlockConfigKey GetInputKey()
        {
            if (!string.IsNullOrEmpty(this.Model))
            {
                var key = new BlockConfigKey
                {
                    EntityType = ClientEntities.Find(this.Model).EntityType,
                    ExtendView = this.ViewName,
                    Type = RafyEnvironment.BranchProvider.HasBranch ? BlockConfigType.Customization : BlockConfigType.Config
                };

                var dv = ViewConfigurationModel.ViewNameProperty.GetMeta(typeof(ViewConfigurationModel)).DefaultValue;
                if (key.ExtendView == dv) { key.ExtendView = null; }

                return key;
            }

            return null;
        }
Example #5
0
        /// <summary>
        /// 把实体列表对应的 json 转换为 EntityList 对象。
        /// </summary>
        /// <param name="jEntityList"></param>
        /// <param name="repository">如果没有显式指定 Repository,则会根据 json 中的 _model 属性来查找对应的实体仓库。</param>
        /// <param name="resultEntityList">如果显式指定 Repository,则会把转换的实体对象都加入到这个列表中。</param>
        /// <returns></returns>
        internal static EntityList JsonToEntity(JObject jEntityList, EntityRepository repository = null, EntityList resultEntityList = null)
        {
            if (repository == null)
            {
                var modelProperty = jEntityList.Property("_model");
                if (modelProperty == null)
                {
                    throw new NotSupportedException("实体列表对应的 Json 应该有 _model 属性。");
                }
                var model        = modelProperty.Value.CastTo <JValue>().Value.CastTo <string>();
                var clientEntity = ClientEntities.Find(model);
                repository = RF.Find(clientEntity.EntityType);
            }

            ListReader reader = repository.SupportTree ? new TreeEntityListReader() : new EntityListReader() as ListReader;

            reader.Repository       = repository;
            reader.ChangeSet        = jEntityList;
            reader.ResultEntityList = resultEntityList;

            reader.Read();

            return(reader.ResultEntityList);
        }
 /// <summary>
 /// 导航面板查询
 /// </summary>
 /// <param name="criteria"></param>
 protected EntityList FetchBy(ViewConfigurationModelNameCriteria criteria)
 {
     Type entityType = ClientEntities.Find(criteria.EntityType).EntityType;
     return this.DA_GetByEntity(entityType, criteria.ViewName);
 }