-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor project structure and update target frameworks
- 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
Showing
28 changed files
with
398 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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: | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
@@ -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: | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
] | ||
} |
Oops, something went wrong.