Skip to content

Commit

Permalink
Enable GenerateDocumentationFile. Add/fix XML docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSandersonMS committed Apr 13, 2018
1 parent 38f1355 commit ae74393
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 29 deletions.
8 changes: 8 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project>
<Import Project="..\Directory.Build.props" />

<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public class BrowserHttpMessageHandler : HttpMessageHandler
static IDictionary<int, TaskCompletionSource<HttpResponseMessage>> _pendingRequests
= new Dictionary<int, TaskCompletionSource<HttpResponseMessage>>();

/// <summary>
/// The name of a well-known property that can be added to <see cref="HttpRequestMessage.Properties"/>
/// to control the arguments passed to the underlying JavaScript <code>fetch</code> API.
/// </summary>
public const string FetchArgs = "BrowserHttpMessageHandler.FetchArgs";

/// <inheritdoc />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

namespace Microsoft.AspNetCore.Blazor.Browser.Interop
{
/// <summary>
/// Represents errors that occur during an interop call from .NET to JavaScript.
/// </summary>
public class JavaScriptException : Exception
{
internal JavaScriptException(string message) : base(message)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,24 @@

using System;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Razor.Language;
using Microsoft.AspNetCore.Razor.Language.Extensions;

namespace Microsoft.AspNetCore.Blazor.Razor
{
/// <summary>
/// Initializes the Blazor extension.
/// </summary>
public class BlazorExtensionInitializer : RazorExtensionInitializer
{
/// <summary>
/// Specifies the declaration configuration.
/// </summary>
public static readonly RazorConfiguration DeclarationConfiguration;

/// <summary>
/// Specifies the default configuration.
/// </summary>
public static readonly RazorConfiguration DefaultConfiguration;

static BlazorExtensionInitializer()
Expand All @@ -29,6 +37,10 @@ static BlazorExtensionInitializer()
Array.Empty<RazorExtension>());
}

/// <summary>
/// Registers the Blazor extension.
/// </summary>
/// <param name="builder">The <see cref="RazorProjectEngineBuilder"/>.</param>
public static void Register(RazorProjectEngineBuilder builder)
{
if (builder == null)
Expand Down Expand Up @@ -71,6 +83,10 @@ public static void Register(RazorProjectEngineBuilder builder)
}
}

/// <summary>
/// Initializes the Blazor extension.
/// </summary>
/// <param name="builder">The <see cref="RazorProjectEngineBuilder"/>.</param>
public override void Initialize(RazorProjectEngineBuilder builder)
{
if (builder == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,48 @@

namespace Microsoft.AspNetCore.Blazor.Razor
{
/// <summary>
/// A <see cref="DocumentClassifierPassBase"/> that recognizes Blazor components.
/// </summary>
public class ComponentDocumentClassifierPass : DocumentClassifierPassBase, IRazorDocumentClassifierPass
{
/// <summary>
/// The component document kind.
/// </summary>
public static readonly string ComponentDocumentKind = "Blazor.Component";

private static readonly char[] PathSeparators = new char[] { '/', '\\' };

/// <summary>
/// The base namespace.
/// </summary>
// This is a fallback value and will only be used if we can't compute
// a reasonable namespace.
public string BaseNamespace { get; set; } = "__BlazorGenerated";

// Set to true in the IDE so we can generated mangled class names. This is needed
// to avoid conflicts between generated design-time code and the code in the editor.
//
// A better workaround for this would be to create a singlefilegenerator that overrides
// the codegen process when a document is open, but this is more involved, so hacking
// it for now.
/// <summary>
/// Gets or sets whether to mangle class names.
///
/// Set to true in the IDE so we can generated mangled class names. This is needed
/// to avoid conflicts between generated design-time code and the code in the editor.
///
/// A better workaround for this would be to create a singlefilegenerator that overrides
/// the codegen process when a document is open, but this is more involved, so hacking
/// it for now.
/// </summary>
public bool MangleClassNames { get; set; } = false;

/// <inheritdoc />
protected override string DocumentKind => ComponentDocumentKind;

/// <inheritdoc />
protected override bool IsMatch(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode)
{
// Treat everything as a component by default if Blazor is part of the configuration.
return true;
}

/// <inheritdoc />
protected override void OnDocumentStructureCreated(
RazorCodeDocument codeDocument,
NamespaceDeclarationIntermediateNode @namespace,
Expand Down Expand Up @@ -145,6 +161,7 @@ void IRazorDocumentClassifierPass.Execute(RazorCodeDocument codeDocument, Docume
documentNode.Target = new BlazorCodeTarget(documentNode.Options, _targetExtensions);
}

/// <inheritdoc />
protected override void OnInitialized()
{
base.OnInitialized();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Microsoft.AspNetCore.Blazor.Razor
{
public class PageDirective
internal class PageDirective
{
public static readonly DirectiveDescriptor Directive = DirectiveDescriptor.CreateDirective(
"page",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,18 @@ namespace Microsoft.AspNetCore.Blazor.Razor
/// </summary>
public class RazorCompilerException : Exception
{
/// <summary>
/// Constructs an instance of <see cref="RazorCompilerException"/>.
/// </summary>
/// <param name="diagnostic"></param>
public RazorCompilerException(RazorDiagnostic diagnostic)
{
Diagnostic = diagnostic;
}

/// <summary>
/// Gets the diagnostic value.
/// </summary>
public RazorDiagnostic Diagnostic { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// Provides extension methods that add Blazor-related middleware to the ASP.NET pipeline.
/// </summary>
public static class BlazorAppBuilderExtensions
{
/// <summary>
Expand Down
4 changes: 4 additions & 0 deletions src/Microsoft.AspNetCore.Blazor.Server/BlazorOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

namespace Microsoft.AspNetCore.Builder
{
/// <summary>
/// Provides configuration options to the <see cref="BlazorAppBuilderExtensions.UseBlazor(IApplicationBuilder, BlazorOptions)"/>
/// middleware.
/// </summary>
public class BlazorOptions
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@

namespace Microsoft.AspNetCore.Blazor.Components
{
/// <summary>
/// Configures options for binding specific element types.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class BindElementAttribute : Attribute
{
/// <summary>
/// Constructs an instance of <see cref="BindElementAttribute"/>.
/// </summary>
/// <param name="element">The tag name of the element.</param>
/// <param name="suffix">The suffix value. For example, set this to <code>value</code> for <code>bind-value</code>, or set this to <code>null</code> for <code>bind</code>.</param>
/// <param name="valueAttribute">The name of the value attribute to be bound.</param>
/// <param name="changeAttribute">The name of an attribute that will register an associated change event.</param>
public BindElementAttribute(string element, string suffix, string valueAttribute, string changeAttribute)
{
if (element == null)
Expand All @@ -30,13 +40,25 @@ public BindElementAttribute(string element, string suffix, string valueAttribute
ChangeAttribute = changeAttribute;
}

/// <summary>
/// Gets the tag name of the element.
/// </summary>
public string Element { get; }

// Set this to `value` for `bind-value` - set this to null for `bind`
/// <summary>
/// Gets the suffix value.
/// For example, this will be <code>value</code> to mean <code>bind-value</code>, or <code>null</code> to mean <code>bind</code>.
/// </summary>
public string Suffix { get; }

/// <summary>
/// Gets the name of the value attribute to be bound.
/// </summary>
public string ValueAttribute { get; }

/// <summary>
/// Gets the name of an attribute that will register an associated change event.
/// </summary>
public string ChangeAttribute { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,19 @@

namespace Microsoft.AspNetCore.Blazor.Components
{
/// <summary>
/// Configures options for binding subtypes of an HTML <code>input</code> element.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class BindInputElementAttribute : Attribute
{
/// <summary>
/// Constructs an instance of <see cref="BindInputElementAttribute"/>.
/// </summary>
/// <param name="type">The value of the element's <code>type</code> attribute.</param>
/// <param name="suffix">The suffix value.</param>
/// <param name="valueAttribute">The name of the value attribute to be bound.</param>
/// <param name="changeAttribute">The name of an attribute that will register an associated change event.</param>
public BindInputElementAttribute(string type, string suffix, string valueAttribute, string changeAttribute)
{
if (valueAttribute == null)
Expand All @@ -25,13 +35,25 @@ public BindInputElementAttribute(string type, string suffix, string valueAttribu
ValueAttribute = valueAttribute;
ChangeAttribute = changeAttribute;
}


/// <summary>
/// Gets the value of the element's <code>type</code> attribute.
/// </summary>
public string Type { get; }

/// <summary>
/// Gets the suffix value.
/// </summary>
public string Suffix { get; }

/// <summary>
/// Gets the name of the value attribute to be bound.
/// </summary>
public string ValueAttribute { get; }

/// <summary>
/// Gets the name of an attribute that will register an associated change event.
/// </summary>
public string ChangeAttribute { get; }
}
}
6 changes: 6 additions & 0 deletions src/Microsoft.AspNetCore.Blazor/Components/BlazorComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ namespace Microsoft.AspNetCore.Blazor.Components
/// </summary>
public abstract class BlazorComponent : IComponent, IHandleEvent
{
/// <summary>
/// Specifies the name of the <see cref="RenderTree"/>-building method.
/// </summary>
public const string BuildRenderTreeMethodName = nameof(BuildRenderTree);

private readonly RenderFragment _renderFragment;
Expand All @@ -33,6 +36,9 @@ public abstract class BlazorComponent : IComponent, IHandleEvent
private bool _hasNeverRendered = true;
private bool _hasPendingQueuedRender;

/// <summary>
/// Constructs an instance of <see cref="BlazorComponent"/>.
/// </summary>
public BlazorComponent()
{
_renderFragment = BuildRenderTree;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,17 @@

namespace Microsoft.AspNetCore.Blazor.Components
{
/// <summary>
/// Associates an event argument type with an event attribute name.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public sealed class EventHandlerAttribute : Attribute
{
/// <summary>
/// Constructs an instance of <see cref="EventHandlerAttribute"/>.
/// </summary>
/// <param name="attributeName"></param>
/// <param name="eventArgsType"></param>
public EventHandlerAttribute(string attributeName, Type eventArgsType)
{
if (attributeName == null)
Expand All @@ -24,8 +32,14 @@ public EventHandlerAttribute(string attributeName, Type eventArgsType)
EventArgsType = eventArgsType;
}

/// <summary>
/// Gets the attribute name.
/// </summary>
public string AttributeName { get; }

/// <summary>
/// Gets the event argument type.
/// </summary>
public Type EventArgsType { get; }
}
}
4 changes: 4 additions & 0 deletions src/Microsoft.AspNetCore.Blazor/Components/EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

namespace Microsoft.AspNetCore.Blazor.Components
{
/// <summary>
/// Holds <see cref="EventHandler"/> attributes to configure the mappings between event names and
/// event argument types.
/// </summary>
[EventHandler("onchange", typeof(UIChangeEventArgs))]
[EventHandler("onclick", typeof(UIMouseEventArgs))]
public static class EventHandlers
Expand Down
10 changes: 10 additions & 0 deletions src/Microsoft.AspNetCore.Blazor/Components/RouteAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@

namespace Microsoft.AspNetCore.Blazor.Components
{
/// <summary>
/// Indicates that the associated component should match the specified route template pattern.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
public class RouteAttribute : Attribute
{
/// <summary>
/// Constructs an instance of <see cref="RouteAttribute"/>.
/// </summary>
/// <param name="template">The route template.</param>
public RouteAttribute(string template)
{
if (template == null)
Expand All @@ -18,6 +25,9 @@ public RouteAttribute(string template)
Template = template;
}

/// <summary>
/// Gets the route template.
/// </summary>
public string Template { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ public static async Task<T> GetJsonAsync<T>(this HttpClient httpClient, string r
/// Sends a POST request to the specified URI, including the specified <paramref name="content"/>
/// in JSON-encoded format, and parses the JSON response body to create an object of the generic type.
/// </summary>
/// <typeparam name="T">A type into which the response body can be JSON-deserialized.</typeparam>
/// <param name="httpClient">The <see cref="HttpClient"/>.</param>
/// <param name="requestUri">The URI that the request will be sent to.</param>
/// <param name="content">Content for the request body. This will be JSON-encoded and sent as a string.</param>
Expand Down
Loading

0 comments on commit ae74393

Please sign in to comment.