/// <summary> /// Creates a new member data provider for the given model. /// </summary> /// <param name="core">The model to be wrapped.</param> public CodeDocMemberDataProvider(ICodeDocMember core) { if(core == null) throw new ArgumentNullException("core"); Contract.EndContractBlock(); Core = core; ContentBase = core as CodeDocMemberContentBase; ValueMember = core as ICodeDocValueMember; Invokable = core as ICodeDocInvokable; Type = core as CodeDocType; Method = core as CodeDocMethod; }
/// <summary> /// Creates a new parameter code doc model. /// </summary> /// <param name="name">The parameter name.</param> /// <param name="parameterType">The parameter type.</param> public CodeDocParameter(string name, ICodeDocMember parameterType) { if(String.IsNullOrEmpty(name)) throw new ArgumentException("Parameter name must contain characters.","name"); Name = name; ParameterType = parameterType; }
protected CodeDocType ToTypeModel(ICodeDocMember member) { if (member == null) return null; if (member is CodeDocType) return (CodeDocType)member; var typeModel = new CodeDocType(member.CRef.WithTargetType("T")); var simpleMember = member as CodeDocSimpleMember; if(simpleMember != null) CopySimpleMemberAttributes(typeModel, simpleMember); return typeModel; }
protected CodeDocProperty ToPropertyModel(ICodeDocMember member) { if (member == null) return null; if (member is CodeDocProperty) return (CodeDocProperty)member; var propertyModel = new CodeDocProperty(member.CRef.WithTargetType("P")); var simpleMember = member as CodeDocSimpleMember; if(simpleMember != null) CopySimpleMemberAttributes(propertyModel, simpleMember); return propertyModel; }
protected CodeDocMethod ToMethodModel(ICodeDocMember member) { if (member == null) return null; if (member is CodeDocMethod) return (CodeDocMethod)member; var methodModel = new CodeDocMethod(member.CRef.WithTargetType("M")); var simpleMember = member as CodeDocSimpleMember; if (simpleMember != null) CopySimpleMemberAttributes(methodModel, simpleMember); return methodModel; }
protected CodeDocField ToFieldModel(ICodeDocMember member) { if (member == null) return null; if (member is CodeDocField) return (CodeDocField)member; var fieldModel = new CodeDocField(member.CRef.WithTargetType("F")); var simpleMember = member as CodeDocSimpleMember; if (simpleMember != null) CopySimpleMemberAttributes(fieldModel, simpleMember); return fieldModel; }
protected CodeDocEvent ToEventModel(ICodeDocMember member) { if (member == null) return null; if (member is CodeDocEvent) return (CodeDocEvent)member; var eventModel = new CodeDocEvent(member.CRef.WithTargetType("F")); var simpleMember = member as CodeDocSimpleMember; if (simpleMember != null) CopySimpleMemberAttributes(eventModel, simpleMember); return eventModel; }