Merge pull request 'Refacoring namespaces' (#2) from NamespaceRenaming into develop
Reviewed-on: http://207.154.223.116:3000/Connected/connected.components/pulls/2
This commit is contained in:
		
						commit
						2126cb7644
					
				@ -1,12 +0,0 @@
 | 
			
		||||
<Router AppAssembly="@typeof(App).Assembly">
 | 
			
		||||
    <Found Context="routeData">
 | 
			
		||||
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
 | 
			
		||||
        <FocusOnNavigate RouteData="@routeData" Selector="h1" />
 | 
			
		||||
    </Found>
 | 
			
		||||
    <NotFound>
 | 
			
		||||
        <PageTitle>Not found</PageTitle>
 | 
			
		||||
        <LayoutView Layout="@typeof(MainLayout)">
 | 
			
		||||
            <p role="alert">Sorry, there's nothing at this address.</p>
 | 
			
		||||
        </LayoutView>
 | 
			
		||||
    </NotFound>
 | 
			
		||||
</Router>
 | 
			
		||||
@ -1,4 +1,4 @@
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
 | 
			
		||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
 | 
			
		||||
 | 
			
		||||
  <PropertyGroup>
 | 
			
		||||
    <TargetFramework>net7.0</TargetFramework>
 | 
			
		||||
@ -7,8 +7,8 @@
 | 
			
		||||
  </PropertyGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0-rc.2.22476.2" />
 | 
			
		||||
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0-rc.2.22476.2" PrivateAssets="all" />
 | 
			
		||||
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="7.0.0" />
 | 
			
		||||
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="7.0.0" PrivateAssets="all" />
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
</Project>
 | 
			
		||||
 | 
			
		||||
@ -1,11 +0,0 @@
 | 
			
		||||
using Connected.Components.Showcase;
 | 
			
		||||
using Microsoft.AspNetCore.Components.Web;
 | 
			
		||||
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
 | 
			
		||||
 | 
			
		||||
var builder = WebAssemblyHostBuilder.CreateDefault(args);
 | 
			
		||||
builder.RootComponents.Add<App>("#app");
 | 
			
		||||
builder.RootComponents.Add<HeadOutlet>("head::after");
 | 
			
		||||
 | 
			
		||||
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
 | 
			
		||||
 | 
			
		||||
await builder.Build().RunAsync();
 | 
			
		||||
@ -1,9 +0,0 @@
 | 
			
		||||
@inherits LayoutComponentBase
 | 
			
		||||
 | 
			
		||||
<HeadContent>
 | 
			
		||||
	<link rel="stylesheet" href="_content/Connected.UI/Components.min.css" />
 | 
			
		||||
	<link rel="stylesheet" href="_content/Connected.UI/Styles.min.css" />
 | 
			
		||||
</HeadContent>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@Body
 | 
			
		||||
@ -1,42 +0,0 @@
 | 
			
		||||
using System.Collections.Concurrent;
 | 
			
		||||
 | 
			
		||||
namespace Connected.Middleware;
 | 
			
		||||
 | 
			
		||||
internal class ComponentMiddlewareService : IComponentMiddlewareService
 | 
			
		||||
{
 | 
			
		||||
	public ComponentMiddlewareService()
 | 
			
		||||
	{
 | 
			
		||||
		Middleware = new();
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	private ConcurrentDictionary<string, List<Type>> Middleware { get; }
 | 
			
		||||
 | 
			
		||||
	public void Add<TMiddleware, TComponent>()
 | 
			
		||||
	{
 | 
			
		||||
		var componentName = typeof(TComponent).FullName;
 | 
			
		||||
 | 
			
		||||
		if (string.IsNullOrEmpty(componentName))
 | 
			
		||||
			throw new ArgumentException(null, nameof(TMiddleware));
 | 
			
		||||
 | 
			
		||||
		if (Middleware.TryGetValue(componentName, out List<Type>? items))
 | 
			
		||||
		{
 | 
			
		||||
			//TODO: sort by priority so multiple inheritance would work 
 | 
			
		||||
			items.Add(typeof(TMiddleware));
 | 
			
		||||
		}
 | 
			
		||||
		else
 | 
			
		||||
			Middleware.TryAdd(componentName, new List<Type> { typeof(TMiddleware) });
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	public Type? Select<TComponent>()
 | 
			
		||||
	{
 | 
			
		||||
		var typeName = typeof(TComponent).FullName;
 | 
			
		||||
 | 
			
		||||
		if (string.IsNullOrEmpty(typeName))
 | 
			
		||||
			throw new ArgumentException(null, nameof(TComponent));
 | 
			
		||||
 | 
			
		||||
		if (Middleware.TryGetValue(typeName, out List<Type>? items) && items is not null && items.Any())
 | 
			
		||||
			return items[0];
 | 
			
		||||
 | 
			
		||||
		return null;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
@ -1,8 +0,0 @@
 | 
			
		||||
namespace Connected.Middleware;
 | 
			
		||||
 | 
			
		||||
public interface IComponentMiddlewareService
 | 
			
		||||
{
 | 
			
		||||
	void Add<TMiddleware, TComponent>();
 | 
			
		||||
 | 
			
		||||
	Type? Select<TComponent>();
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user