public override IList <DataRuleProblem> Analyze(DataRuleSetting ruleSetting, DataRuleExecutionContext context) { if (context.ModelElement.Name == null) { return(null); } var problems = new List <DataRuleProblem> (); var sqlTable = ( ISqlTable )context.ModelElement; if (sqlTable.Name.Parts[1] != "HiValue") { ISqlConstraint primaryKey = sqlTable.GetPrimaryKey(); if (primaryKey == null) { string ruleProblemDescription = string.Format(CultureInfo.CurrentCulture, "Table [{0}].[{1}] does not have a Primary Key.", context.ModelElement.Name.Parts[0], context.ModelElement.Name.Parts[1]); var problem = new DataRuleProblem(this, ruleProblemDescription, sqlTable) { FileName = sqlTable.PrimarySource.SourceName, StartLine = sqlTable.PrimarySource.StartLine, StartColumn = sqlTable.PrimarySource.StartColumn }; problems.Add(problem); } } return(problems); }
private static ISqlConstraint AppendWhere(ISqlConstraint old, ISqlConstraint newConstraint) { if (old != null) { newConstraint = new SqlBinaryConstraint { Left = old, Opeartor = SqlBinaryConstraintType.And, Right = newConstraint }; } return(newConstraint); }
private static ISqlConstraint AppendWhere(ISqlConstraint old, ISqlConstraint newConstraint) { if (old != null) { newConstraint = new SqlBinaryConstraint { Left = old, Opeartor = SqlBinaryConstraintType.And, Right = newConstraint }; } return newConstraint; }