private static string GetPropertyName(ModelPropertyClass property, Element element) { string propertyName = null; if (element != null && element.Children.OfType <Property>().ToDictionary(x => x.Name, x => x.OverrideName).TryGetValue(property.Name, out propertyName)) { return(propertyName); } return(property.Name); }
public T GetMetadataProperty <T>(ModelPropertyClass property) { return(relationshipInstance.GetProperty <T>(property)); }
public object this[ModelPropertyClass property] { get { return(Element[property]); } }
public object GetProperty(ModelPropertyClass property) { return(Element.GetProperty(property)); }
public T GetProperty <T>(ModelPropertyClass property) { return(Element.GetProperty <T>(property)); }
private static void DumpProperty(ModelPropertyClass property, TSqlObject instance) { Console.WriteLine(property.Name); Console.WriteLine(property.GetValue<object>(instance)); }
public override IList <SqlRuleProblem> Analyze(SqlRuleExecutionContext ruleExecutionContext) { var problems = new List <SqlRuleProblem>(); var sqlObj = ruleExecutionContext.ModelElement; if (sqlObj == null || sqlObj.IsWhiteListed()) { return(problems); } var fragment = ruleExecutionContext.ScriptFragment.GetFragment( typeof(CreateTableStatement), typeof(CreateProcedureStatement), typeof(CreateFunctionStatement), typeof(CreateTriggerStatement) ); var objName = sqlObj.Name.GetName(); var objType = sqlObj.ObjectType; ModelPropertyClass ansiNullsOption = null; ModelPropertyClass quotedIdentifierOption = null; var impactsFunctionality = false; var objTypeName = string.Empty; if (objType == Table.TypeClass) { impactsFunctionality = true; ansiNullsOption = Table.AnsiNullsOn; quotedIdentifierOption = Table.QuotedIdentifierOn; objTypeName = "table"; } else if (objType == ScalarFunction.TypeClass) { ansiNullsOption = ScalarFunction.AnsiNullsOn; quotedIdentifierOption = ScalarFunction.QuotedIdentifierOn; objTypeName = "function"; } else if (objType == TableValuedFunction.TypeClass) { ansiNullsOption = TableValuedFunction.AnsiNullsOn; quotedIdentifierOption = TableValuedFunction.QuotedIdentifierOn; objTypeName = "function"; } else if (objType == Procedure.TypeClass) { ansiNullsOption = Procedure.AnsiNullsOn; quotedIdentifierOption = Procedure.QuotedIdentifierOn; objTypeName = "stored procedure"; } else if (objType == DmlTrigger.TypeClass) { ansiNullsOption = DmlTrigger.AnsiNullsOn; quotedIdentifierOption = DmlTrigger.QuotedIdentifierOn; objTypeName = "trigger"; } var ansiNullsOn = sqlObj.GetProperty <bool>(ansiNullsOption); var quotedIdentifierOn = sqlObj.GetProperty <bool>(quotedIdentifierOption); if (!ansiNullsOn || !quotedIdentifierOn) { var options = new List <string>(); if (!ansiNullsOn) { options.Add("ANSI_NULLS OFF"); } if (!quotedIdentifierOn) { options.Add("QUOTED_IDENTIFIER OFF"); } var errorMessage = string.Format(impactsFunctionality ? Message : MessageNoEffect, string.Join(", ", options)); problems.Add(new SqlRuleProblem(errorMessage, sqlObj)); } return(problems); }
private static void DumpProperty(ModelPropertyClass property, TSqlObject instance) { Console.WriteLine(property.Name); Console.WriteLine(property.GetValue <object>(instance)); }