Grails 2.5.1 to Grails 3.3.2

时间:2017-12-26 09:40:23

标签: grails yaml grails3

我正在使用Grails 2.5.1并升级以使用我在Grails 3.3.2下面找到的config.groovy:{/ p>

contactNumber.domain.size= 8..16

我在application.yml

中将其更改为以下内容
contactNumber :
 domain :
  size : 8..16

是吗?

1 个答案:

答案 0 :(得分:3)

  

是吗?

没有。您的8..16文件中有application.yml,并且可能希望将其评估为Groovy表达式,其计算结果为Range,而不是grails-app/conf/application.groovy

如果要将配置值表示为Groovy表达式,请创建Config.groovy并使用与Grails 1或Grails 2中的application.groovy中使用的语法相同的语法。该文件不存在默认但如果您创建它,框架将识别它并使用它。您可以同时使用application.ymlpublic async Task<List<TableB>> GetTableBResults(string vCode, string number) { var tableARepo = DependencyResolver.Get<IRepository<DBTableA>>(); var TableBRepo = DependencyResolver.Get<IRepository<DBTableB>>(); var tableAQuery = string.Format("SELECT * FROM DBTableA WHERE Identifier = '{0}'", number); List<DBTableA> tableA = await tableARepo.QueryAsync(tableAQuery); if (tableA != null) { //Find all tableB records with info from Identifier //And then do a distinct on BusinessName and return those results foreach (var item in DBTableA) { var TableBQuery = String.Format("SELECT *" + "FROM[DBTableB] INNER JOIN DBTableA" + "ON DBTableB.Code = {0}" + "AND DBTableB.HouseNo = {1}" + "AND DBTableB.BusinessName = {2}" + "AND DBTableB.VCode = {3}", item.Code, item.HouseNo, item.FirstName, vCode); List<DBTableB> tableB = await TableBRepo.QueryAsync(TableBQuery); if (tableBs != null) { return tableBs.Select(_ => new TableB { BoroCode = _.BoroCode, Code = _.Code, HouseNo = _.HouseNo, Date = _.Date, BusinessName = _.BusinessName, }).ToList(); } else { return new List<TableB>(); } } } return new List<TableB>(); }