Beispiel #1
0
 public AptCtl(string subPath, string modelName)
 {
     _rootSpaceName = AbpSolutionBll.GetRootNameSpace();
     _baseClase     = AbpSolutionBll.GetBaseClassName(AbpProjectType.WebHost);;
     _subPath       = subPath;
     _modelName     = modelName;
 }
Beispiel #2
0
        public string GetDtoNameSapce()
        {
            var    rootNameSpace = AbpSolutionBll.GetRootNameSpace();
            string dtoNameSpace;

            if (!string.IsNullOrWhiteSpace(_subPath))
            {
                dtoNameSpace = $"{rootNameSpace}.{_subPath.Trim()}.{_modelName}s.Dto";
            }
            else
            {
                dtoNameSpace = $"{rootNameSpace}.{_modelName}s.Dto";
            }

            return(dtoNameSpace);
        }
Beispiel #3
0
        private void InsetDtoFiles(List <IAbpCtlItem> ctlItems, string dtoBasePath)
        {
            var dtoPath = System.IO.Path.Combine(dtoBasePath, "Dto");

            System.IO.Directory.CreateDirectory(dtoPath);
            var dtos = ctlItems.SelectMany(x => x.Dtos).Distinct();

            foreach (var dto in dtos)
            {
                InsertDtoFile(dtoPath, dto);
            }
            var fileDtoMapperProfile = System.IO.Path.Combine(dtoPath, $"{_modelName}Profile.cs");

            AbpSolutionBll.InsertCodeFile(fileDtoMapperProfile,
                                          (new AbpAppDtoMapperProfile())
                                          .GetText(AbpSolutionBll.GetRootNameSpace(), _subPath, _modelName));
        }
Beispiel #4
0
        public string GetInterfaceText()
        {
            var    lname            = _modelName.ToFirstLettleLcase();
            var    _name            = _modelName.ToUnderLineStringcase();
            var    name             = _modelName;
            var    baseClase        = AbpSolutionBll.GetBaseClassName(AbpProjectType.Application);;
            string managerNameSpace = GetManagerNameSapce();
            var    result           = tplInterface.Replace("$name$", name)
                                      .Replace("$_name$", _name)
                                      .Replace("$lname$", lname)
                                      .Replace("$manager.name.space$", managerNameSpace)
                                      .Replace("$baseClass$", baseClase)
                                      //.Replace("$items$", GetInterfaceItemsCode(items))
                                      .Replace("$root.name.space$", AbpSolutionBll.GetRootNameSpace())
            ;

            return(result);
        }
Beispiel #5
0
        public string GetInterfaceText(List <IAbpAppItem> items = null)
        {
            var    lname        = _modelName.ToFirstLettleLcase();
            var    _name        = _modelName.ToUnderLineStringcase();
            var    name         = _modelName;
            var    baseClase    = AbpSolutionBll.GetBaseClassName(AbpProjectType.Application);;
            string appNameSpace = GetAppServiceNameSapce();
            var    result       = tplInterface.Replace("$name$", name)
                                  .Replace("$_name$", _name)
                                  .Replace("$lname$", lname)
                                  .Replace("$app.nameSapce$", appNameSpace)
                                  .Replace("$baseClass$", baseClase)
                                  .Replace("$items$", GetInterfaceItemsCode(items))
                                  .Replace("$using$", VbpCoderSetting.GetValue().AppUsing)
                                  .Replace("$root.name.space$", AbpSolutionBll.GetRootNameSpace())
                                  .Replace("$usingDto$", $"using {GetDtoNameSapce()};");

            return(result);
        }
Beispiel #6
0
        public string GetServiceText(List <IAbpAppItem> items = null)
        {
            var    lname            = _modelName.ToFirstLettleLcase();
            var    _name            = _modelName.ToUnderLineStringcase();
            var    name             = _modelName;
            var    baseClase        = AbpSolutionBll.GetBaseClassName(AbpProjectType.Domain);;
            string managerNameSpace = GetManagerNameSapce();
            var    result           = tpl.Replace("$name$", name)
                                      .Replace("$_name$", _name)
                                      .Replace("$lname$", lname)
                                      .Replace("$manager.name.space$", managerNameSpace)
                                      .Replace("$baseClass$", baseClase)
                                      .Replace("$using$", VbpCoderSetting.GetValue().ManagerUsing)
                                      //.Replace("$items$", GetServiceItemsCode(items))
                                      .Replace("$root.name.space$", AbpSolutionBll.GetRootNameSpace())
            ;

            return(result);
        }
Beispiel #7
0
        private string GetDtoCode(string dtoName)
        {
            var code = tplDto.Replace("$root.name.space$", AbpSolutionBll.GetRootNameSpace())
                       .Replace("$dtoname$", dtoName)
                       .Replace("$using$", VbpCoderSetting.GetValue().DtoUsing)
                       .Replace("$dto.name.space$", GetDtoNameSapce());

            if (dtoName.StartsWith("Get") && dtoName.EndsWith("Input"))
            {
                code = code.Replace("$some.sample.code$", tplGetInputDtoSampleCode);
            }
            if (dtoName.StartsWith("Get") && dtoName.EndsWith("Output"))
            {
                code = code.Replace("$some.sample.code$", "public string Code {get;set;}");
            }
            if (dtoName.StartsWith("Put") || dtoName.StartsWith("Abandon"))
            {
                code = code.Replace("$some.sample.code$", "public byte[] RowVersion { get; set; }");
            }
            code = code.Replace("$some.sample.code$", "");
            return(code);
        }
Beispiel #8
0
        public string GetAppServiceNameSapce()
        {
            var rootNameSpace = AbpSolutionBll.GetRootNameSpace();

            return(string.IsNullOrWhiteSpace(_subPath) ? rootNameSpace : $"{rootNameSpace}.{_subPath}.{_modelName}s");
        }