Skip to content

Commit

Permalink
Refactor project structure and update target frameworks
Browse files Browse the repository at this point in the history
- Introduced `ActiveUsers` feature in `Blazor` with classes and interfaces to manage user states.
- Removed obsolete `Directory.Build.targets.no` and added `Directory.Build.targets` targeting `DgmjrSdk`.
- Updated `Dgmjr.AspNetCore.csproj` to correct the property name for multi-targeting frameworks.
- Standardized time zone notation across all `LICENSE.md` files and extended copyright to 2024.
- Added `.vscode` configuration files to aid in debugging and task management for `Http` project.
- Cleaned up and commented out unused package references in various `.csproj` files.
- Removed redundant `Dgmjr.AspNetCore.Mvc.sln` as part of solution consolidation.
- Streamlined MVC framework extension methods and improved logging with expanded `LoggerExtensions`.
- Consolidated license and metadata information across various component licenses.

The restructuring streamlines project configurations and prepares for the integration of new features while ensuring consistency in licensing metadata and smoothing out development workflows with the provision of editor configurations. The addition of the `ActiveUser` functionality paves the way for improved user state management in Blazor applications, reinforcing the ecosystem's capabilities for real-time interactivity.
  • Loading branch information
dgmjr committed Feb 21, 2024
1 parent 684b201 commit e0a8bc0
Show file tree
Hide file tree
Showing 28 changed files with 398 additions and 191 deletions.
20 changes: 20 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!--
* Directory.Build.targets
*
* Created: 2023-01-11-05:08:45
* Modified: 2023-01-11-11:47:51
*
* Author: David G. Moore, Jr, <[email protected]>
*
* Copyright © 2022-2023 David G. Moore, Jr,, All Rights Reserved
* License: MIT (https://opensource.org/licenses/MIT)
-->

<Project>
<Import Project="Sdk.targets" Sdk="DgmjrSdk" Condition="'$(DgmjrSdkTargets)' == ''" />
<PropertyGroup>
<DgmjrSdkTargets>$(MSBuildThisFileDirectory)Sdk.targets</DgmjrSdkTargets>
<!-- <InheritedDirectoryBuildTargets>$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))</InheritedDirectoryBuildTargets> -->
</PropertyGroup>
<!-- <Import Project="$(InheritedDirectoryBuildTargets)" Condition="Exists('$(InheritedDirectoryBuildTargets)')" /> -->
</Project>
20 changes: 0 additions & 20 deletions Directory.Build.targets.no

This file was deleted.

2 changes: 1 addition & 1 deletion src/All/Dgmjr.AspNetCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFramework>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net8.0</TargetFrameworks>
<Description>This is a metapackage of all of the ASP.NET Core Dgmjr packages</Description>
</PropertyGroup>
<ItemGroup>
Expand Down
28 changes: 14 additions & 14 deletions src/All/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
date: 2023-07-13T05:44:46:00.048Z
date: 2023-07-13T05:44:46:00-05:00Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
- include-copyright
limitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51:00.216Z
- liability
- warranty
lastmod: 2024-01-0T00:39:00.0000+05:00Z
license: MIT
slug: mit-license
title: MIT License
Expand All @@ -25,7 +25,7 @@ type: license

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved
## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
Binary file added src/All/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 27 additions & 0 deletions src/Blazor.ActiveUsers/ConnectedUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace Dgmjr.Blazor.ActiveUsers;
using System.Security.Claims;
using Microsoft.Identity.Web;

public record class ActiveUser : IDisposable
{
public ActiveUser(ClaimsPrincipal? User = null, ActiveUsersList? ActiveUsersList = null)
{
this.User = User;
this.ActiveUsersList = ActiveUsersList;
ActiveUsersList?.Add(this);
}

public ClaimsPrincipal? User { get; }
public ActiveUsersList? ActiveUsersList { get; }

public string UserId => User?.GetObjectId() ?? "Unknown";
public string? Name => User?.GetName();
public string? Username => User?.GetUsername();
public string? Email => User?.GetEmail();
public string? PhoneNumber => User?.GetPhoneNumber();

public void Dispose()
{
ActiveUsersList?.Remove(this);
}
}
16 changes: 16 additions & 0 deletions src/Blazor.ActiveUsers/ConnectedUsersAutoConfigurator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace Dgmjr.Blazor.ActiveUsers;

using Microsoft.AspNetCore.Builder;
using System.Security.Claims;
using Microsoft.Extensions.DependencyInjection;

public class ActiveUsersAutoConfigurator : IConfigureIHostApplicationBuilder
{
public ConfigurationOrder Order => ConfigurationOrder.AnyTime;

public void Configure(WebApplicationBuilder builder)
{
builder.Services.AddScoped<ActiveUser>();
builder.Services.AddSingleton<IActiveUsersList, ActiveUsersList>();
}
}
25 changes: 25 additions & 0 deletions src/Blazor.ActiveUsers/ConnectedUsersList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Dgmjr.Blazor.ActiveUsers;

using System.Collections;
using System.Collections.Concurrent;
using System.Threading.Tasks.Sources;
using System.Collections.Generic;

public class ActiveUsersList : ConcurrentDictionary<string, ActiveUser>, IActiveUsersList, IDictionary<string, ActiveUser>, ICollection<ActiveUser>
{
public virtual bool IsReadOnly => false;

public virtual bool Remove(ActiveUser user) => TryRemove(user.UserId, out _);
public new virtual ActiveUser[] ToArray() => Values.ToArray();
public virtual void CopyTo(ActiveUser[] array, int index) => Values.CopyTo(array, index);

public virtual void Add(ActiveUser user) => TryAdd(user.UserId, user);

public virtual bool Contains(ActiveUser user) => Contains(user.UserId);

public virtual bool Contains(guid userId) => Contains(userId.ToString());

public virtual bool Contains(string userId) => base.ContainsKey(userId);

IEnumerator<ActiveUser> IEnumerable<ActiveUser>.GetEnumerator() => Values.GetEnumerator();
}
19 changes: 19 additions & 0 deletions src/Blazor.ActiveUsers/Dgmjr.Blazor.ActiveUsers.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFrameworks>net8.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Usings" />
<PackageReference Include="Microsoft.Identity.Web" />
<PackageReference Include="Dgmjr.Identity.Claims" />
<PackageReference Include="Dgmjr.Configuration.Extensions" />
</ItemGroup>
<ItemGroup>
<PackageFile Include="./icon.png" PackagePath="icon.png" />
<PackageFile Include="./bin/$(Configuration)/$(TargetFramework)/**/*.dll" PackagePath="lib/$(TargetFramework)/%(Filename)%(Extension)" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions src/Blazor.ActiveUsers/IActiveUsersList.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Dgmjr.Blazor.ActiveUsers;
using System.Collections.Generic;

public interface IActiveUsersList
{
void Add(ActiveUser user);
ActiveUser[] ToArray();
bool Remove(ActiveUser user);
bool Contains(ActiveUser user);
bool Contains(guid userId);
int Count { get; }
}
35 changes: 35 additions & 0 deletions src/Blazor.ActiveUsers/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
date: 2023-07-13T05:44:46:00-05:00Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
limitations:
- liability
- warranty
lastmod: 2024-01-0T00:39:00.0000+05:00Z
license: MIT
slug: mit-license
title: MIT License
type: license
---

# MIT License

## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Binary file added src/Blazor.ActiveUsers/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/Blazor.EfCore/Dgmjr.Blazor.EntityFrameworkCore.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Usings" />
</ItemGroup>
</Project>
26 changes: 13 additions & 13 deletions src/Formatters/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
---
date: 2023-07-13T05:44:46:00+05:00Z
date: 2023-07-13T05:44:46:00-05:00Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
- include-copyright
limitations:
- liability
- warranty
- liability
- warranty
lastmod: 2024-01-0T00:39:00.0000+05:00Z
license: MIT
slug: mit-license
Expand All @@ -25,7 +25,7 @@ type: license

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore an email") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved
## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
28 changes: 14 additions & 14 deletions src/Hosting.Extensions/LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
---
date: 2023-07-13T05:44:46:00.048Z
date: 2023-07-13T05:44:46:00-05:00Z
description: Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files, yadda, yadda, yadda...
keywords:
- IP
- copyright
- license
- mit
- IP
- copyright
- license
- mit
permissions:
- commercial-use
- modifications
- distribution
- private-use
- commercial-use
- modifications
- distribution
- private-use
conditions:
- include-copyright
- include-copyright
limitations:
- liability
- warranty
lastmod: 2023-08-29T17:13:51:00.216Z
- liability
- warranty
lastmod: 2024-01-0T00:39:00.0000+05:00Z
license: MIT
slug: mit-license
title: MIT License
Expand All @@ -25,7 +25,7 @@ type: license

# MIT License

## Copyright © 2022-2023 [David G. Moore, Jr.](mailto:[email protected] "Send David an email") ([@dgmjr](https://github.com/dgmjr "Contact david on GitHub")), All Rights Reserved
## Copyright © 2022-2024 [David G. Moore, Jr.](mailto:[email protected] "Send Dr. Moore") ([@dgmjr](https://github.com/dgmjr "Contact Dr. Moore on GitHub")), All Rights Reserved

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
35 changes: 35 additions & 0 deletions src/Http/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"version": "0.2.0",
"configurations": [
{
// Use IntelliSense to find out which attributes exist for C# debugging
// Use hover for the description of the existing attributes
// For further information visit https://github.com/dotnet/vscode-csharp/blob/main/debugger-launchjson.md.
"name": ".NET Core Launch (web)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/CorrelationId/samples/3.1/MvcSample/bin/Local/netcoreapp3.1/MvcSample.dll",
"args": [],
"cwd": "${workspaceFolder}/CorrelationId/samples/3.1/MvcSample",
"stopAtEntry": false,
// Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
}
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
}
]
}
Loading

0 comments on commit e0a8bc0

Please sign in to comment.