/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(TypeNode type) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, ServiceContractAttribute); if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute)) { List <string> duplicated = new List <string>(); foreach (Member member in type.Members) { if (SemanticRulesUtilities.GetAttribute(member, OperationContractAttribute) != null) { if (duplicated.Contains(member.Name.Name)) { Resolution resolution = base.GetResolution(member.FullName); Problem problem = new Problem(resolution, type.SourceContext); base.Problems.Add(problem); } else { duplicated.Add(member.Name.Name); } } } } return(base.Problems); }
private ProblemCollection CheckForProblems(AttributeNode attribute) { if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute)) { // reset the hasUnmatchedMessageHandler flag for each new type hasUnmatchedMessageHandler = false; return(base.Problems); } string action = SemanticRulesUtilities.GetAttributeValue <String>(attribute, "Action"); if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && !string.IsNullOrEmpty(action) && action.Equals("*", StringComparison.OrdinalIgnoreCase)) { // check if we already inspected another operation with unmatched message handler if (hasUnmatchedMessageHandler) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); return(base.Problems); } hasUnmatchedMessageHandler = true; } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(Member member) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(member, OperationBehaviorAttribute); if (SemanticRulesUtilities.HasAttribute <OperationBehaviorAttribute>(attribute) && member.DeclaringType.NodeType != NodeType.Class) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, member.SourceContext); base.Problems.Add(problem); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(Member member) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(member, OperationContractAttribute); if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && IsMixingMessageContractParams((Method)member)) { Resolution resolution = base.GetResolution(member.Name.Name); Problem problem = new Problem(resolution, member.SourceContext); base.Problems.Add(problem); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(TypeNode type) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, ServiceContractAttribute); if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute) && !IsValidCallbackContract(SemanticRulesUtilities.GetAttributeValue <TypeNode>(attribute, "CallbackContract"))) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); return(base.Problems); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(Member member) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(member, OperationContractAttribute); if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && SemanticRulesUtilities.GetAttributeValue <Boolean>(attribute, "IsOneWay") && !string.IsNullOrEmpty(SemanticRulesUtilities.GetAttributeValue <String>(attribute, "ReplyAction"))) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, member.SourceContext); base.Problems.Add(problem); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(TypeNode type) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, ServiceContractAttribute); if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute) && attribute.Expressions.Count == 0) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); return(base.Problems); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(Member member) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(member, OperationContractAttribute); if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && SemanticRulesUtilities.GetAttributeValue <Boolean>(attribute, "IsOneWay") && HasOutParams(((Method)member))) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, member.SourceContext); base.Problems.Add(problem); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(TypeNode type) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, ServiceContractAttribute); if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute) && string.IsNullOrEmpty(SemanticRulesUtilities.GetAttributeValue <string>(attribute, "Name"))) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); return(base.Problems); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(Member member) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(member, OperationContractAttribute); if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && SemanticRulesUtilities.GetAttributeValue <Boolean>(attribute, "IsOneWay") && member.NodeType == NodeType.Method && !((Method)member).ReturnType.FullName.Equals("System.Void", StringComparison.Ordinal)) { Resolution resolution = base.GetResolution(); Problem problem = new Problem(resolution, member.SourceContext); base.Problems.Add(problem); } return(base.Problems); }
/// <summary> /// Checks the specified type. /// </summary> /// <param name="type">The type.</param> /// <returns></returns> public override ProblemCollection Check(TypeNode type) { AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, ServiceContractAttribute); if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute, "CallbackContract")) { TypeNode callbackContract = SemanticRulesUtilities.GetAttributeValue <TypeNode>(attribute, "CallbackContract"); foreach (Member member in callbackContract.Members) { if (member.NodeType == NodeType.Method && !SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(member)) { Resolution resolution = base.GetResolution(member.FullName, callbackContract.FullName); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); } } return(base.Problems); } return(base.Problems); }
protected virtual void EvaluateTypeNode(TypeNode type, string binding) { if (type == null) { throw new ArgumentNullException("type"); } if (binding == null) { throw new ArgumentNullException("binding"); } AttributeNode attribute = SemanticRulesUtilities.GetAttribute(type, typeof(ServiceContractAttribute)); if (configurationManager != null) { if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute)) { EvaluateRule(type, attribute, binding); } } }
private ProblemCollection CheckForProblems(AttributeNode attribute, Member member) { if (SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute)) { // store state for check member analysis overload. hasSessionMode = SemanticRulesUtilities.HasAttribute <ServiceContractAttribute>(attribute, "SessionMode"); if (hasSessionMode) { sessionMode = SemanticRulesUtilities.GetAttributeValue <SessionMode>(attribute, "SessionMode"); } return(base.Problems); } if (SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute) && IsRuleViolated(attribute)) { Resolution resolution = base.GetResolution(CustomizeDescription(attribute), member.Name.Name); Problem problem = new Problem(resolution, attribute.SourceContext); base.Problems.Add(problem); return(base.Problems); } return(base.Problems); }
private bool HasInitiatingOrTerminatingValuesDeclared(AttributeNode attribute) { return(SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute, "IsInitiating") || SemanticRulesUtilities.HasAttribute <OperationContractAttribute>(attribute, "IsTerminating")); }