public override bool CanDo(RuntimeArgument argument)
 {
     foreach (var project in argument.Projects)
     {
         if (string.IsNullOrWhiteSpace(project.BusinessPath) || !Directory.Exists(project.BusinessPath))
         {
             StateMessage = $"项目【{project}】的路径设置不正确!";
             return(false);
         }
     }
     return(true);
 }
 /// <summary>
 /// 能否执行的检查
 /// </summary>
 public bool CanDo(RuntimeArgument argument)
 {
     if (string.IsNullOrWhiteSpace(SolutionConfig.Current.RootPath) || !Directory.Exists(SolutionConfig.Current.RootPath))
     {
         noWriteFile  = true;
         StateMessage = "解决方案根路径设置不正确,已禁用文件生成!";
     }
     foreach (var project in argument.Projects)
     {
         if (string.IsNullOrWhiteSpace(project.ModelPath))
         {
             noWriteFile  = true;
             StateMessage = $"项目【{project}】的路径设置不正确,已禁用文件生成!";
         }
     }
     return(true);
 }
        /// <summary>
        /// 命令使用的
        /// </summary>
        /// <param name="args"></param>
        /// <param name="setArgs"></param>
        /// <returns></returns>
        private bool DoPrepare(object args, Action <object> setArgs)
        {
            var argument = new RuntimeArgument
            {
                Argument = args ?? GlobalConfig.CurrentConfig
            };

            if (!CanDo(argument))
            {
                return(false);
            }
            Prepare(argument);
            bool success = true;

            foreach (var project in argument.Projects)
            {
                if (Validate(project))
                {
                    continue;
                }
                success = false;
                MessageBox.Show("有错误配置,请检查");
            }
            foreach (var entity in argument.Entities)
            {
                if (Validate(entity))
                {
                    continue;
                }
                success = false;
                MessageBox.Show("有错误配置,请检查");
            }
            if (success)
            {
                setArgs(argument);
            }
            return(success);
        }
 public override void Prepare(RuntimeArgument argument)
 {
     _builder = _creater();
     _builder.MessageSetter = MessageSetter;
 }
 /// <summary>
 /// 能否执行的检查
 /// </summary>
 public virtual bool CanDo(RuntimeArgument argument)
 {
     return(true);
 }
 /// <summary>
 /// 能否执行的检查
 /// </summary>
 public virtual bool Prepare(RuntimeArgument argument)
 {
     return(true);
 }
 /// <summary>
 /// 处理后
 /// </summary>
 /// <param name="argument"></param>
 /// <returns></returns>
 public virtual void EndDo(RuntimeArgument argument)
 {
 }
 public bool Prepare(RuntimeArgument argument)
 {
     _builder = _creater();
     _builder.MessageSetter = MessageSetter;
     return(true);
 }
 /// <summary>
 /// 处理后
 /// </summary>
 /// <param name="argument"></param>
 /// <returns></returns>
 public void EndDo(RuntimeArgument argument)
 {
     _codes = WorkContext.FileCodes;
     codeScope.Dispose();
 }
Esempio n. 10
0
 /// <summary>
 /// 处理前
 /// </summary>
 /// <param name="argument"></param>
 /// <returns></returns>
 public bool BeginDo(RuntimeArgument argument)
 {
     codeScope = FileCodeScope.CreateScope(noWriteFile);
     return(true);
 }
Esempio n. 11
0
 /// <summary>
 /// 能否执行的检查
 /// </summary>
 public virtual void Prepare(RuntimeArgument argument)
 {
 }