private bool IsValid() { if (json == null) { throw new Exception($"{LOG} 'profile' not found: '{arguments.Profile}'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solution.Length == 0 || json.solution == "???") { throw new Exception($"{LOG} 'solution' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.datasource == null || json.datasource.Length == 0 || json.datasource == "???") { throw new Exception($"{LOG} 'datasource' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (!XrmHelper.IsExistSolution(crmServiceClient, json.solution, out var solutionId, out var prefix)) { throw new Exception($"{LOG} solution '{json.solution}' not exist"); } SolutionId = solutionId; Prefix = prefix; DataSourceName = json.datasource.ToLower().StartsWith(prefix.ToLower()) ? json.datasource : $"{Prefix}{json.datasource}"; if (!XrmHelper.IsExistDataSource(crmServiceClient, $"{DataSourceName}")) { throw new Exception($"{LOG} name '{json.datasource}' not exist with prefix: {Prefix}"); } return(true); }
private bool IsValid() { if (json == null) { throw new Exception($"{LOG} 'profile' not found: '{arguments.Profile}'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solution.Length == 0 || json.solution == "???") { throw new Exception($"{LOG} 'solution' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (!XrmHelper.IsExistSolution(crmServiceClient, json.solution, out var solutionId, out var prefix)) { throw new Exception($"{LOG} solution '{json.solution}' not exist"); } SolutionId = solutionId; Prefix = prefix; if (IsSupportWebResourceDependency) { foreach (var dependency in Dependencies) { var check = dependency.dependencies.Where(x => x.StartsWith("???_/")).Any(); if (check) { throw new Exception($"{LOG} Found ???_/ in webresource dependencies. Please check DynamicsCrm.DevKit.Cli.json file !!!"); } var check2 = dependency.webresources.Where(x => x.StartsWith("???_/")).Any(); if (check2) { throw new Exception($"{LOG} Found ???_/ in webresource dependencies. Please check DynamicsCrm.DevKit.Cli.json file !!!"); } } } return(true); }
private bool IsValid() { if (json == null) { throw new Exception($"{LOG} 'profile' not found: '{arguments.Profile}'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solution.Length == 0 || json.solution == "???") { throw new Exception($"{LOG} 'solution' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.displayname.Length == 0 || json.displayname == "???") { throw new Exception($"{LOG} 'displayname' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.pluralname.Length == 0 || json.pluralname == "???") { throw new Exception($"{LOG} 'pluralname' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.name.Length == 0 || json.name == "???") { throw new Exception($"{LOG} 'name' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } var regex = new Regex("^[a-zA-Z][_a-zA-Z0-9\\s,]*$"); if (!regex.IsMatch(json.displayname)) { throw new Exception($"{LOG} 'displayname' can only contain alpha-numeric and underscore characters."); } if (!regex.IsMatch(json.pluralname)) { throw new Exception($"{LOG} 'pluralname' can only contain alpha-numeric and underscore characters."); } if (!regex.IsMatch(json.name)) { throw new Exception($"{LOG} 'name' can only contain alpha-numeric and underscore characters."); } if (json.name.Contains(" ")) { throw new Exception($"{LOG} 'name' can cannot contain space character."); } if (!XrmHelper.IsExistSolution(crmServiceClient, json.solution, out var solutionId, out var prefix)) { throw new Exception($"{LOG} solution '{json.solution}' not exist"); } //SolutionId = solutionId; Prefix = prefix; DataSourceName = json.name.ToLower().StartsWith(prefix.ToLower()) ? json.name : $"{Prefix}{json.name}"; if (XrmHelper.IsExistDataSource(crmServiceClient, DataSourceName)) { throw new Exception($"{LOG} name '{DataSourceName}' exist"); } return(true); }
private bool IsValid() { if (json == null) { throw new Exception($"{LOG} 'profile' not found: '{arguments.Profile}'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solution == "???" || (json.solution != null && json?.solution?.Trim().Length == 0)) { throw new Exception($"{LOG} 'solution' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (!XrmHelper.IsExistSolution(crmServiceClient, json.solution, out var solutionId, out var prefix)) { throw new Exception($"{LOG} solution '{json.solution}' not exist"); } return(true); }
private bool IsValid() { if (json == null) { throw new Exception($"{LOG} 'profile' not found: '{arguments.Profile}'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solution.Length == 0 || json.solution == "???") { throw new Exception($"{LOG} 'solution' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solutiontype.Length == 0 || json.solutiontype == "???") { throw new Exception($"{LOG} 'solutiontype' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.solutiontype.ToLower() != "Managed".ToLower() && json.solutiontype.ToLower() != "Unmanaged".ToLower() && json.solutiontype.ToLower() != "Both".ToLower()) { throw new Exception($"{LOG} 'solutiontype' should be: 'Managed' or 'Unmanaged' or 'Both'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.folder.Length == 0 || json.folder == "???") { throw new Exception($"{LOG} 'folder' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.type.Length == 0 || json.type == "???") { throw new Exception($"{LOG} 'type' 'empty' or '???'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (json.type.ToLower() != "Extract".ToLower() && json.type.ToLower() != "Pack".ToLower()) { throw new Exception($"{LOG} 'type' should be: 'Extract' or 'Pack'. Please check DynamicsCrm.DevKit.Cli.json file."); } if (!XrmHelper.IsExistSolution(crmServiceClient, json.solution, out var solutionId, out var prefix)) { throw new Exception($"{LOG} solution '{json.solution}' not exist"); } if (json.mapfile != null && json.mapfile.Length > 0) { var map = $"{currentDirectory}\\{json.mapfile}"; if (!File.Exists(map)) { throw new Exception($"{LOG} mapfile '{map}' not exist"); } } return(true); }