Skip to content

Commit

Permalink
Updated docs and all
Browse files Browse the repository at this point in the history
  • Loading branch information
david-driscoll committed Jul 2, 2019
1 parent 205612a commit df25438
Show file tree
Hide file tree
Showing 58 changed files with 175 additions and 177 deletions.
4 changes: 2 additions & 2 deletions Packages.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup>
<GlobalPackageReference Include="Rocket.Surgery.Build.Metadata" Version="3.3.1" />
<GlobalPackageReference Include="Rocket.Surgery.Build.Metadata" Version="3.3.3" />
<!-- <GlobalPackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.3" /> -->
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19270-01" />
<GlobalPackageReference Include="Roslynator.Analyzers" Version="2.1.0-rc" />
Expand Down Expand Up @@ -36,4 +36,4 @@
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Update="XunitXml.TestLogger" Version="2.1.26" />
</ItemGroup>
</Project>
</Project>
3 changes: 1 addition & 2 deletions sample/Sample.DependencyOne/Class1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Rocket.Surgery.Conventions;
using Rocket.Surgery.Conventions;
using Sample.DependencyOne;

[assembly: Convention(typeof(Class1))]
Expand Down
3 changes: 1 addition & 2 deletions sample/Sample.DependencyThree/Class3.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Rocket.Surgery.Conventions;
using Rocket.Surgery.Conventions;
using Sample.DependencyOne;
using Sample.DependencyThree;

Expand Down
3 changes: 1 addition & 2 deletions sample/Sample.DependencyTwo/Class2.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Rocket.Surgery.Conventions;
using Rocket.Surgery.Conventions;
using Sample.DependencyTwo;

[assembly: Convention(typeof(Class2))]
Expand Down
3 changes: 1 addition & 2 deletions src/Builders.Abstractions/IBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;

namespace Rocket.Surgery.Builders
{
Expand Down
13 changes: 7 additions & 6 deletions src/Builders/Builder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Rocket.Surgery.Builders
{
/// <summary>
/// Abstract base class for implementing a builder
/// Implements the <see cref="Rocket.Surgery.Builders.IBuilder" />
/// Implements the <see cref="IBuilder" />
/// </summary>
/// <seealso cref="Rocket.Surgery.Builders.IBuilder" />
/// <seealso cref="IBuilder" />
public abstract class Builder : IBuilder
{
/// <summary>
Expand All @@ -27,7 +27,7 @@ protected Builder(IDictionary<object, object> properties)

public virtual object this[object item]
{
get => Properties.TryGetValue(item, out object value) ? value : null;
get => Properties.TryGetValue(item, out var value) ? value : null;
set => Properties[item] = value;
}

Expand All @@ -41,17 +41,18 @@ public virtual object this[object item]
/// <summary>
/// Abstract base class for creating builders that are attached to some parent builder
/// Useful for creating sub builds that live for a short period to augment the parent.
/// Implements the <see cref="Rocket.Surgery.Builders.Builder" />
/// Implements the <see cref="Builder" />
/// </summary>
/// <typeparam name="TBuilder">The type of the t builder.</typeparam>
/// <seealso cref="Rocket.Surgery.Builders.Builder" />
/// <seealso cref="Builder" />
public abstract class Builder<TBuilder> : Builder
where TBuilder : class
{
/// <summary>
/// Constructs a Builder&lt;TBuilder&gt; with the parent instance
/// Constructs a Builder{TBuilder} with the parent instance
/// </summary>
/// <param name="parent">The parent builder TBuilder</param>
/// <param name="properties">The properties</param>
protected Builder(TBuilder parent, IDictionary<object, object> properties) : base(properties)
{
Parent = parent ?? throw new ArgumentNullException(nameof(parent));
Expand Down
4 changes: 2 additions & 2 deletions src/Conventions.Abstractions/ConventionAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ namespace Rocket.Surgery.Conventions
/// <summary>
/// An attribute that defines a convention for this entire assembly
/// The type attached to the convention must implement <see cref="IConvention" /> but may also implement other interfaces
/// Implements the <see cref="System.Attribute" />
/// Implements the <see cref="Attribute" />
/// </summary>
/// <seealso cref="System.Attribute" />
/// <seealso cref="Attribute" />
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public sealed class ConventionAttribute : Attribute
{
Expand Down
8 changes: 3 additions & 5 deletions src/Conventions.Abstractions/IConvention.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Collections.Generic;

namespace Rocket.Surgery.Conventions
namespace Rocket.Surgery.Conventions
{
/// <summary>
/// A marker interface to indicate a type is a convention
Expand All @@ -11,10 +9,10 @@ public interface IConvention { }
/// A default interface that can be used to create a convention with a known context type
/// context is used to house all the data that the convention requires to do it's job
/// This can be things like a service collection, container builder, logger, etc.
/// Implements the <see cref="Rocket.Surgery.Conventions.IConvention" />
/// Implements the <see cref="IConvention" />
/// </summary>
/// <typeparam name="TContext">The convention type that contains all the values for this convention to work</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.IConvention" />
/// <seealso cref="IConvention" />
public interface IConvention<in TContext> : IConvention
where TContext : IConventionContext
{
Expand Down
6 changes: 2 additions & 4 deletions src/Conventions.Abstractions/IConventionBuilder.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
using System;
using System.Collections.Generic;
using Rocket.Surgery.Conventions.Reflection;
using Rocket.Surgery.Conventions.Scanners;

namespace Rocket.Surgery.Conventions
{
/// <summary>
/// IConventionBuilder
/// Implements the <see cref="Rocket.Surgery.Conventions.IConventionContainer{TBuilder, TConvention, TDelegate}" />
/// Implements the <see cref="IConventionContainer{TBuilder, TConvention, TDelegate}" />
/// </summary>
/// <typeparam name="TBuilder">The type of the t builder.</typeparam>
/// <typeparam name="TConvention">The type of the t convention.</typeparam>
/// <typeparam name="TDelegate">The type of the t delegate.</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.IConventionContainer{TBuilder, TConvention, TDelegate}" />
/// <seealso cref="IConventionContainer{TBuilder, TConvention, TDelegate}" />
public interface IConventionBuilder<out TBuilder, in TConvention, in TDelegate> : IConventionContainer<TBuilder, TConvention, TDelegate>
where TBuilder : IConventionBuilder<TBuilder, TConvention, TDelegate>
where TConvention : IConvention
Expand Down
9 changes: 5 additions & 4 deletions src/Conventions.Abstractions/IConventionComposer.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
using System;
using System.Collections.Generic;
// ReSharper disable UnusedTypeParameter

namespace Rocket.Surgery.Conventions
{
/// <summary>
/// A composer that allows registration of delegates and interfaces that implement an interface like the delegate
/// Implements the <see cref="Rocket.Surgery.Conventions.IConvention{TContext}" />
/// Implements the <see cref="IConvention{TContext}" />
/// </summary>
/// <typeparam name="TContext">The context type</typeparam>
/// <typeparam name="TContribution">The contribution type</typeparam>
/// <typeparam name="TDelegate">The delegate Type</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.IConvention{TContext}" />
/// <seealso cref="IConvention{TContext}" />
public interface IConventionComposer<in TContext, TContribution, TDelegate> : IConvention<TContext>
where TContribution : IConvention<TContext>
where TContext : IConventionContext
Expand All @@ -20,9 +21,9 @@ public interface IConventionComposer<in TContext, TContribution, TDelegate> : IC

/// <summary>
/// Takes a list of conventions and composes them with the given context
/// Implements the <see cref="Rocket.Surgery.Conventions.IConvention{TContext}" />
/// Implements the <see cref="IConvention{TContext}" />
/// </summary>
/// <seealso cref="Rocket.Surgery.Conventions.IConvention{TContext}" />
/// <seealso cref="IConvention{TContext}" />
public interface IConventionComposer
{
/// <summary>
Expand Down
1 change: 0 additions & 1 deletion src/Conventions.Abstractions/IConventionContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using Microsoft.Extensions.Logging;
using Rocket.Surgery.Conventions.Scanners;

namespace Rocket.Surgery.Conventions
{
Expand Down
4 changes: 2 additions & 2 deletions src/Conventions.Abstractions/IConventionHostBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ public interface IConventionHostBuilder

/// <summary>
/// IConventionHostBuilder
/// Implements the <see cref="Rocket.Surgery.Conventions.IConventionHostBuilder" />
/// Implements the <see cref="IConventionHostBuilder" />
/// </summary>
/// <typeparam name="TSelf">The type of the t self.</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.IConventionHostBuilder" />
/// <seealso cref="IConventionHostBuilder" />
public interface IConventionHostBuilder<out TSelf> : IConventionHostBuilder
where TSelf : IConventionHostBuilder<TSelf>
{
Expand Down
8 changes: 4 additions & 4 deletions src/Conventions.Abstractions/IServiceProviderDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ namespace Rocket.Surgery.Conventions
{
/// <summary>
/// IServiceProviderDictionary
/// Implements the <see cref="System.Collections.Generic.IDictionary{System.Object, System.Object}" />
/// Implements the <see cref="System.IServiceProvider" />
/// Implements the <see cref="IDictionary{Object, Object}" />
/// Implements the <see cref="IServiceProvider" />
/// </summary>
/// <seealso cref="System.Collections.Generic.IDictionary{System.Object, System.Object}" />
/// <seealso cref="System.IServiceProvider" />
/// <seealso cref="IDictionary{Object, Object}" />
/// <seealso cref="IServiceProvider" />
public interface IServiceProviderDictionary : IDictionary<object, object>, IServiceProvider { }
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static class AssemblyCandidateFinderExtenisons
/// <param name="finder">The <see cref="IAssemblyCandidateFinder" /></param>
/// <param name="candidate">The first candidate to find</param>
/// <param name="candidates">The candidates as an array</param>
/// <returns>IEnumerable&lt;Assembly&gt;.</returns>
/// <returns>IEnumerable{Assembly}.</returns>
public static IEnumerable<Assembly> GetCandidateAssemblies(this IAssemblyCandidateFinder finder, string candidate, params string[] candidates)
{
return finder.GetCandidateAssemblies(new[] {candidate}.Concat(candidates).ToArray());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public interface IAssemblyCandidateFinder
/// Get the candidates for a given set
/// </summary>
/// <param name="candidates">The candidates as an enumerable</param>
/// <returns>IEnumerable&lt;Assembly&gt;.</returns>
/// <returns>IEnumerable{Assembly}.</returns>
IEnumerable<Assembly> GetCandidateAssemblies(IEnumerable<string> candidates);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public interface IAssemblyProvider
/// <summary>
/// Get the full list of assemblies
/// </summary>
/// <returns>IEnumerable&lt;Assembly&gt;.</returns>
/// <returns>IEnumerable{Assembly}.</returns>
IEnumerable<Assembly> GetAssemblies();
}
}
6 changes: 4 additions & 2 deletions src/Conventions.Abstractions/RocketEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Rocket.Surgery.Conventions
{
/// <summary>
/// RocketEnvironment.
/// Implements the <see cref="Rocket.Surgery.Conventions.IRocketEnvironment" />
/// Implements the <see cref="IRocketEnvironment" />
/// </summary>
/// <seealso cref="Rocket.Surgery.Conventions.IRocketEnvironment" />
/// <seealso cref="IRocketEnvironment" />
public class RocketEnvironment : IRocketEnvironment
{
/// <summary>
Expand All @@ -28,7 +28,9 @@ public RocketEnvironment(string environmentName, string applicationName, string
/// Initializes a new instance of the <see cref="RocketEnvironment" /> class.
/// </summary>
/// <param name="environment">The environment.</param>
#pragma warning disable 618
public RocketEnvironment(IHostingEnvironment environment)
#pragma warning restore 618
{
EnvironmentName = environment.EnvironmentName;
ApplicationName = environment.ApplicationName;
Expand Down
8 changes: 8 additions & 0 deletions src/Conventions.Abstractions/RocketEnvironmentExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,19 @@ public static bool IsEnvironment(
/// </summary>
/// <param name="environment">The environment.</param>
/// <returns>IRocketEnvironment.</returns>
#pragma warning disable 618
public static IRocketEnvironment Convert(this IHostingEnvironment environment)
#pragma warning restore 618
{
return new RocketEnvironment(environment);
}
#if NETCOREAPP3_0

/// <summary>
/// Converts the specified environment.
/// </summary>
/// <param name="environment">The environment.</param>
/// <returns>IRocketEnvironment.</returns>
public static IRocketEnvironment Convert(this IHostEnvironment environment)
{
return new RocketEnvironment(environment);
Expand Down
10 changes: 5 additions & 5 deletions src/Conventions.Abstractions/Scanners/DelegateOrConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ namespace Rocket.Surgery.Conventions.Scanners
{
/// <summary>
/// A pattern match class that is used to determine if a type is a <see cref="IConvention" />, a <see cref="Delegate" /> or <see cref="None" />
/// Implements the <see cref="System.IEquatable{Rocket.Surgery.Conventions.Scanners.DelegateOrConvention}" />
/// Implements the <see cref="DelegateOrConvention" />
/// </summary>
/// <seealso cref="System.IEquatable{Rocket.Surgery.Conventions.Scanners.DelegateOrConvention}" />
/// <seealso cref="DelegateOrConvention" />
public struct DelegateOrConvention : IEquatable<DelegateOrConvention>
{
/// <summary>
Expand Down Expand Up @@ -91,10 +91,10 @@ public static implicit operator DelegateOrConvention(Delegate @delegate)
}

/// <summary>
/// Determines whether the specified <see cref="System.Object" />, is equal to this instance.
/// Determines whether the specified <see cref="object" />, is equal to this instance.
/// </summary>
/// <param name="obj">The <see cref="System.Object" /> to compare with this instance.</param>
/// <returns><c>true</c> if the specified <see cref="System.Object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
/// <param name="obj">The <see cref="object" /> to compare with this instance.</param>
/// <returns><c>true</c> if the specified <see cref="object" /> is equal to this instance; otherwise, <c>false</c>.</returns>
public override bool Equals(object obj)
{
return obj is DelegateOrConvention && Equals((DelegateOrConvention)obj);
Expand Down
4 changes: 2 additions & 2 deletions src/Conventions.Abstractions/Scanners/IConventionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public interface IConventionProvider
/// </summary>
/// <typeparam name="TContribution">The type of the contribution.</typeparam>
/// <typeparam name="TDelegate">The type of the delegate.</typeparam>
/// <returns>IEnumerable&lt;DelegateOrConvention&gt;.</returns>
/// <returns>IEnumerable{DelegateOrConvention}.</returns>
IEnumerable<DelegateOrConvention> Get<TContribution, TDelegate>()
where TContribution : IConvention
where TDelegate : Delegate;

/// <summary>
/// Gets a all the conventions from the provider
/// </summary>
/// <returns>IEnumerable&lt;DelegateOrConvention&gt;.</returns>
/// <returns>IEnumerable{DelegateOrConvention}.</returns>
IEnumerable<DelegateOrConvention> GetAll();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;

namespace Rocket.Surgery.Conventions.Scanners
Expand Down
5 changes: 2 additions & 3 deletions src/Conventions/Composer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using Microsoft.Extensions.Logging;
using Rocket.Surgery.Conventions.Scanners;

namespace Rocket.Surgery.Conventions
Expand All @@ -11,12 +10,12 @@ public static class Composer
{
/// <summary>
/// ComposerImpl.
/// Implements the <see cref="Rocket.Surgery.Conventions.ConventionComposer{TContext, TContribution, TDelegate}" />
/// Implements the <see cref="ConventionComposer{TContext, TContribution, TDelegate}" />
/// </summary>
/// <typeparam name="TContext">The type of the t context.</typeparam>
/// <typeparam name="TContribution">The type of the t contribution.</typeparam>
/// <typeparam name="TDelegate">The type of the t delegate.</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.ConventionComposer{TContext, TContribution, TDelegate}" />
/// <seealso cref="ConventionComposer{TContext, TContribution, TDelegate}" />
class ComposerImpl<TContext, TContribution, TDelegate> : ConventionComposer<TContext, TContribution, TDelegate>
where TContribution : IConvention<TContext>
where TContext : IConventionContext
Expand Down
22 changes: 17 additions & 5 deletions src/Conventions/ConventionBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,36 @@
using Rocket.Surgery.Conventions.Reflection;
using Rocket.Surgery.Conventions.Scanners;
using System.Collections.Generic;
using System.Linq;

namespace Rocket.Surgery.Conventions
{
/// <summary>
/// ConventionBuilder.
/// Implements the <see cref="Rocket.Surgery.Conventions.ConventionContainerBuilder{TBuilder, TConvention, TDelegate}" />
/// Implements the <see cref="Rocket.Surgery.Conventions.IConventionBuilder{TBuilder, TConvention, TDelegate}" />
/// Implements the <see cref="ConventionContainerBuilder{TBuilder, TConvention, TDelegate}" />
/// Implements the <see cref="IConventionBuilder{TBuilder, TConvention, TDelegate}" />
/// </summary>
/// <typeparam name="TBuilder">The type of the t builder.</typeparam>
/// <typeparam name="TConvention">The type of the t convention.</typeparam>
/// <typeparam name="TDelegate">The type of the t delegate.</typeparam>
/// <seealso cref="Rocket.Surgery.Conventions.ConventionContainerBuilder{TBuilder, TConvention, TDelegate}" />
/// <seealso cref="Rocket.Surgery.Conventions.IConventionBuilder{TBuilder, TConvention, TDelegate}" />
/// <seealso cref="ConventionContainerBuilder{TBuilder, TConvention, TDelegate}" />
/// <seealso cref="IConventionBuilder{TBuilder, TConvention, TDelegate}" />
public abstract class ConventionBuilder<TBuilder, TConvention, TDelegate> : ConventionContainerBuilder<TBuilder, TConvention, TDelegate>, IConventionBuilder<TBuilder, TConvention, TDelegate>
where TBuilder : IConventionBuilder<TBuilder, TConvention, TDelegate>
where TConvention : IConvention
where TDelegate : Delegate
{
/// <summary>
/// Initializes a new instance of the <see cref="ConventionBuilder{TBuilder, TConvention, TDelegate}"/> class.
/// </summary>
/// <param name="scanner">The scanner.</param>
/// <param name="assemblyProvider">The assembly provider.</param>
/// <param name="assemblyCandidateFinder">The assembly candidate finder.</param>
/// <param name="properties">The properties.</param>
/// <exception cref="ArgumentNullException">
/// assemblyProvider
/// or
/// assemblyCandidateFinder
/// </exception>
protected ConventionBuilder(
IConventionScanner scanner,
IAssemblyProvider assemblyProvider,
Expand All @@ -43,6 +54,7 @@ IDictionary<object, object> properties
/// </summary>
/// <value>The assembly provider.</value>
public IAssemblyProvider AssemblyProvider { get; }

/// <summary>
/// Gets the assembly candidate finder.
/// </summary>
Expand Down
Loading

0 comments on commit df25438

Please sign in to comment.