diff --git a/src/Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.sln b/src/Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.sln deleted file mode 100644 index 04d4675c..00000000 --- a/src/Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.sln +++ /dev/null @@ -1,42 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" - ProjectSection(SolutionItems) = preProject - ..\..\Directory.Build.props = ..\..\Directory.Build.props - ..\..\..\..\Directory.Build.targets = ..\..\..\..\Directory.Build.targets - ..\..\..\..\global.json = ..\..\..\..\global.json - ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Communication.Abstractions", "Dgmjr.AspNetCore.Communication.Abstractions.csproj", "{3B567DE2-8008-43B6-B04C-20586C7F30CF}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Local|Any CPU = Local|Any CPU - Debug|Any CPU = Debug|Any CPU - Testing|Any CPU = Testing|Any CPU - Staging|Any CPU = Staging|Any CPU - Production|Any CPU = Production|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Local|Any CPU.ActiveCfg = Local|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Local|Any CPU.Build.0 = Local|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Testing|Any CPU.Build.0 = Testing|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Staging|Any CPU.Build.0 = Staging|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Production|Any CPU.ActiveCfg = Local|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Production|Any CPU.Build.0 = Local|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {3B567DE2-8008-43B6-B04C-20586C7F30CF}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {F12DE833-DBD0-4D15-B0CC-14B581964C28} - EndGlobalSection -EndGlobal diff --git a/src/Communication/.vscode/settings.json b/src/Communication/.vscode/settings.json new file mode 100644 index 00000000..9d904b84 --- /dev/null +++ b/src/Communication/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "sonarlint.connectedMode.project": { + "connectionId": "dgmjr-io", + "projectKey": "dgmjr-io_Dgmjr.Communication" + } +} \ No newline at end of file diff --git a/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.csproj b/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.csproj new file mode 100644 index 00000000..84b8b932 --- /dev/null +++ b/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.csproj @@ -0,0 +1,21 @@ + + + + + $(TargetedDotNetFrameworks) + + + + + + diff --git a/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.sln b/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.sln new file mode 100644 index 00000000..b7b7eab6 --- /dev/null +++ b/src/Communication/All/Dgmjr.Azure.CommunicationServices.All.sln @@ -0,0 +1,70 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" + ProjectSection(SolutionItems) = preProject + ..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props + ..\..\..\..\..\Directory.Build.targets = ..\..\..\..\..\Directory.Build.targets + ..\..\..\..\..\global.json = ..\..\..\..\..\global.json + ..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices", "..\Communcation\Dgmjr.Azure.CommunicationServices.csproj", "{3D36177C-5640-4BA3-86FD-7E73A849EC55}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.Abstractions", "..\Communication.Abstractions\Dgmjr.Azure.CommunicationServices.Abstractions.csproj", "{8C663B7A-804D-457E-ADCB-5AAF9390387F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.All", "Dgmjr.Azure.CommunicationServices.All.csproj", "{F8812B66-F966-497B-9777-752226D538FC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Local|Any CPU = Local|Any CPU + Debug|Any CPU = Debug|Any CPU + Testing|Any CPU = Testing|Any CPU + Staging|Any CPU = Staging|Any CPU + Production|Any CPU = Production|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.ActiveCfg = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.Build.0 = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.Build.0 = Testing|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.Build.0 = Staging|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.ActiveCfg = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.Build.0 = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.Build.0 = Release|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Local|Any CPU.ActiveCfg = Local|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Local|Any CPU.Build.0 = Local|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Testing|Any CPU.Build.0 = Testing|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Staging|Any CPU.Build.0 = Staging|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Production|Any CPU.ActiveCfg = Local|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Production|Any CPU.Build.0 = Local|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8C663B7A-804D-457E-ADCB-5AAF9390387F}.Release|Any CPU.Build.0 = Release|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Local|Any CPU.ActiveCfg = Local|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Local|Any CPU.Build.0 = Local|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Testing|Any CPU.Build.0 = Testing|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Staging|Any CPU.Build.0 = Staging|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Production|Any CPU.ActiveCfg = Local|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Production|Any CPU.Build.0 = Local|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8812B66-F966-497B-9777-752226D538FC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {BA9DF526-DE32-44E2-A6AB-12A4E855F480} + EndGlobalSection +EndGlobal diff --git a/src/Communication.Abstractions/LICENSE.md b/src/Communication/All/LICENSE.md similarity index 100% rename from src/Communication.Abstractions/LICENSE.md rename to src/Communication/All/LICENSE.md diff --git a/src/Communication/All/icon.png b/src/Communication/All/icon.png new file mode 100644 index 00000000..df642aaf Binary files /dev/null and b/src/Communication/All/icon.png differ diff --git a/src/Communication/AzureCommunicationServicesAutoConfigurator.cs b/src/Communication/Communcation/AzureCommunicationServicesAutoConfigurator.cs similarity index 96% rename from src/Communication/AzureCommunicationServicesAutoConfigurator.cs rename to src/Communication/Communcation/AzureCommunicationServicesAutoConfigurator.cs index 3de996e6..88e54e11 100644 --- a/src/Communication/AzureCommunicationServicesAutoConfigurator.cs +++ b/src/Communication/Communcation/AzureCommunicationServicesAutoConfigurator.cs @@ -48,7 +48,7 @@ public void Configure(IApplicationBuilder builder) } } - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { var optionsSection = builder.Configuration.GetSection( AzureCommunicationServicesOptionsBase.ConfigurationSectionName diff --git a/src/Communication/AzureCommunicationServicesOptions.cs b/src/Communication/Communcation/AzureCommunicationServicesOptions.cs similarity index 100% rename from src/Communication/AzureCommunicationServicesOptions.cs rename to src/Communication/Communcation/AzureCommunicationServicesOptions.cs diff --git a/src/Communication/Dgmjr.AspNetCore.Communication.csproj b/src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.csproj similarity index 86% rename from src/Communication/Dgmjr.AspNetCore.Communication.csproj rename to src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.csproj index 73cbf1a5..9d37bc79 100644 --- a/src/Communication/Dgmjr.AspNetCore.Communication.csproj +++ b/src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.csproj @@ -16,6 +16,7 @@ comms true $(TargetedDotNetFrameworks) + 3d36177c-5640-4ba3-86fd-7e73a849ec55 @@ -24,16 +25,19 @@ - - - + - + + + + + + diff --git a/src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.sln b/src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.sln new file mode 100644 index 00000000..b96e1774 --- /dev/null +++ b/src/Communication/Communcation/Dgmjr.Azure.CommunicationServices.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" + ProjectSection(SolutionItems) = preProject + ..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props + ..\..\..\..\..\Directory.Build.targets = ..\..\..\..\..\Directory.Build.targets + ..\..\..\..\..\global.json = ..\..\..\..\..\global.json + ..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.Abstractions", "..\Communication.Abstractions\Dgmjr.Azure.CommunicationServices.Abstractions.csproj", "{0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices", "Dgmjr.Azure.CommunicationServices.csproj", "{3D36177C-5640-4BA3-86FD-7E73A849EC55}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Local|Any CPU = Local|Any CPU + Debug|Any CPU = Debug|Any CPU + Testing|Any CPU = Testing|Any CPU + Staging|Any CPU = Staging|Any CPU + Production|Any CPU = Production|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Local|Any CPU.ActiveCfg = Local|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Local|Any CPU.Build.0 = Local|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Testing|Any CPU.Build.0 = Testing|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Staging|Any CPU.Build.0 = Staging|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Production|Any CPU.ActiveCfg = Local|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Production|Any CPU.Build.0 = Local|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A4E64AB-8215-49F8-A5E9-64DA4BF48C87}.Release|Any CPU.Build.0 = Release|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.ActiveCfg = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Local|Any CPU.Build.0 = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Testing|Any CPU.Build.0 = Testing|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Staging|Any CPU.Build.0 = Staging|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.ActiveCfg = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Production|Any CPU.Build.0 = Local|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D36177C-5640-4BA3-86FD-7E73A849EC55}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {991D96AC-24E8-4358-9F0C-99BE9D5C3BE5} + EndGlobalSection +EndGlobal diff --git a/src/Communication/Email/EmailSender.cs b/src/Communication/Communcation/Email/EmailSender.cs similarity index 100% rename from src/Communication/Email/EmailSender.cs rename to src/Communication/Communcation/Email/EmailSender.cs diff --git a/src/Communication/Email/EmailSenderOptions.cs b/src/Communication/Communcation/Email/EmailSenderOptions.cs similarity index 88% rename from src/Communication/Email/EmailSenderOptions.cs rename to src/Communication/Communcation/Email/EmailSenderOptions.cs index 018258d7..736a93d5 100644 --- a/src/Communication/Email/EmailSenderOptions.cs +++ b/src/Communication/Communcation/Email/EmailSenderOptions.cs @@ -22,7 +22,8 @@ public record class EmailSenderOptions : AzureCommunicationServicesOptions options) : base(options) { @@ -51,11 +50,9 @@ public EmailSenderOptions(AzureCommunicationServicesOptions option SecurityFrom = options.SecurityFrom; } - [SetsRequiredMembers] public EmailSenderOptions(string connectionString, EmailAddress? defaultFrom = null) : this(Parse(connectionString) with { DefaultFrom = defaultFrom ?? EmailAddress.Empty }) { } - [SetsRequiredMembers] public EmailSenderOptions(string endpoint, string accessKey, EmailAddress? defaultFrom = null) { DefaultFrom = defaultFrom ?? EmailAddress.Empty; @@ -63,7 +60,9 @@ public EmailSenderOptions(string endpoint, string accessKey, EmailAddress? defau AccessKey = accessKey; } - [SetsRequiredMembers] public EmailSenderOptions() : this(EmptyValue) { } + + public IDictionary Addresses { get; set; } = + new Dictionary(); } diff --git a/src/Communication/Email/MailSendResult.cs b/src/Communication/Communcation/Email/MailSendResult.cs similarity index 59% rename from src/Communication/Email/MailSendResult.cs rename to src/Communication/Communcation/Email/MailSendResult.cs index 6e1d8020..749937c5 100644 --- a/src/Communication/Email/MailSendResult.cs +++ b/src/Communication/Communcation/Email/MailSendResult.cs @@ -1,18 +1,19 @@ namespace Dgmjr.AspNetCore.Communication.Email; +using System.Runtime.CompilerServices; + /// /// Represents the result of sending an email. /// -public readonly record struct MailSendResult : IMailSendResult +public readonly record struct MailSendResult(Azure.Communication.Email.EmailSendResult result) + : IMailSendResult { /// /// Gets or sets the response code of the email send result. /// - public Abstractions.IMailSendResponseCode Status - { - get => MailSendResponseCode.FromId(StatusCode)!; - init => StatusCode = ((IIdentifiable)value).Id; - } + public Abstractions.IMailSendResponseCode Status => MailSendResponseCode.Parse(StatusName); + + public string StatusName => result.Status.ToString(); /// /// Gets a value indicating whether the email send operation was successful. @@ -24,5 +25,5 @@ public Abstractions.IMailSendResponseCode Status /// /// Gets or sets the status code of the email send result. /// - public int StatusCode { get; init; } + public int StatusCode => ((IIdentifiable)Status).Id; } diff --git a/src/Communication/LICENSE.md b/src/Communication/Communcation/LICENSE.md similarity index 100% rename from src/Communication/LICENSE.md rename to src/Communication/Communcation/LICENSE.md diff --git a/src/Communication/Communcation/Sms/SmsSendResult.cs b/src/Communication/Communcation/Sms/SmsSendResult.cs new file mode 100644 index 00000000..026b8e4c --- /dev/null +++ b/src/Communication/Communcation/Sms/SmsSendResult.cs @@ -0,0 +1,34 @@ +namespace Dgmjr.AspNetCore.Communication.Sms; + +/// +/// Represents the result of sending an SMS message. +/// +public readonly record struct SmsSendResult(Azure.Communication.Sms.SmsSendResult result) + : ISmsSendResult +{ + // public SmsSendResult + // { + // StatusCode = result.HttpStatusCode; + // ErrorMessage = result.ErrorMessage; + // To = (PhoneNumber)result.To; + // } + + public string? ErrorMessage => result.ErrorMessage; + public PhoneNumber To => (PhoneNumber)result.To; + + /// + /// Gets the status code of the message send result. + /// + public int StatusCode => result.HttpStatusCode; + + /// + /// Gets a value indicating whether the SMS message was sent successfully. + /// + public bool IsSuccess => + StatusCode is SmsSendResponseCode.Success.Id or SmsSendResponseCode.Accepted.Id; + + /// + /// Gets or sets the response code of the SMS send result. + /// + public Abstractions.ISmsSendResponseCode Status => SmsSendResponseCode.FromId(StatusCode); +} diff --git a/src/Communication/Sms/SmsSender.cs b/src/Communication/Communcation/Sms/SmsSender.cs similarity index 100% rename from src/Communication/Sms/SmsSender.cs rename to src/Communication/Communcation/Sms/SmsSender.cs diff --git a/src/Communication/Sms/SmsSenderOptions.cs b/src/Communication/Communcation/Sms/SmsSenderOptions.cs similarity index 91% rename from src/Communication/Sms/SmsSenderOptions.cs rename to src/Communication/Communcation/Sms/SmsSenderOptions.cs index 43969970..0c6593ba 100644 --- a/src/Communication/Sms/SmsSenderOptions.cs +++ b/src/Communication/Communcation/Sms/SmsSenderOptions.cs @@ -62,4 +62,7 @@ public SmsSenderOptions(string connectionString, PhoneNumber? fromPhoneNumber) { DefaultFrom = fromPhoneNumber.HasValue ? fromPhoneNumber.Value : PhoneNumber.Empty; } + + public IDictionary Numbers { get; set; } = + new Dictionary(); } diff --git a/src/Communication/Communcation/icon.png b/src/Communication/Communcation/icon.png new file mode 100644 index 00000000..df642aaf Binary files /dev/null and b/src/Communication/Communcation/icon.png differ diff --git a/src/Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.csproj b/src/Communication/Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.csproj similarity index 100% rename from src/Communication.Abstractions/Dgmjr.AspNetCore.Communication.Abstractions.csproj rename to src/Communication/Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.csproj diff --git a/src/Communication/Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.sln b/src/Communication/Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.sln new file mode 100644 index 00000000..e97b9fd3 --- /dev/null +++ b/src/Communication/Communication.Abstractions/Dgmjr.Azure.CommunicationServices.Abstractions.sln @@ -0,0 +1,42 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" + ProjectSection(SolutionItems) = preProject + ..\..\..\Directory.Build.props = ..\..\..\Directory.Build.props + ..\..\..\..\..\Directory.Build.targets = ..\..\..\..\..\Directory.Build.targets + ..\..\..\..\..\global.json = ..\..\..\..\..\global.json + ..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Azure.CommunicationServices.Abstractions", "Dgmjr.Azure.CommunicationServices.Abstractions.csproj", "{26882AB4-6533-4957-9F15-7B966FDEA4BC}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Local|Any CPU = Local|Any CPU + Debug|Any CPU = Debug|Any CPU + Testing|Any CPU = Testing|Any CPU + Staging|Any CPU = Staging|Any CPU + Production|Any CPU = Production|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Local|Any CPU.ActiveCfg = Local|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Local|Any CPU.Build.0 = Local|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Testing|Any CPU.Build.0 = Testing|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Staging|Any CPU.Build.0 = Staging|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Production|Any CPU.ActiveCfg = Local|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Production|Any CPU.Build.0 = Local|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {26882AB4-6533-4957-9F15-7B966FDEA4BC}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {7BD0ECFE-3F2C-4425-AEB8-E2AA398925B1} + EndGlobalSection +EndGlobal diff --git a/src/Communication.Abstractions/Enums/MailSendReponseCode.cs b/src/Communication/Communication.Abstractions/Enums/MailSendReponseCode.cs similarity index 58% rename from src/Communication.Abstractions/Enums/MailSendReponseCode.cs rename to src/Communication/Communication.Abstractions/Enums/MailSendReponseCode.cs index 25533e38..3bf56a05 100644 --- a/src/Communication.Abstractions/Enums/MailSendReponseCode.cs +++ b/src/Communication/Communication.Abstractions/Enums/MailSendReponseCode.cs @@ -13,9 +13,27 @@ namespace Dgmjr.AspNetCore.Communication.Email.Enums; [GenerateEnumerationRecordStruct("MailSendResponseCode", "Dgmjr.AspNetCore.Communication.Email")] public enum MailSendResponseCode { + [Display( + Name = "Succeeded", + Description = "The request was successful and the message has been queued for delivery." + )] Succeeded = 200, + + [Display( + Name = "Accepted", + Description = "The request was successful and the message has been accepted to be queued for delivery." + )] NotStarted = 201, + + [Display( + Name = "Running", + Description = "The request is running and the message is being sent" + )] Running = 202, + + [Display(Name = "Cancelled", Description = "The request has been cancelled.")] Canceled = 406, + + [Display(Name = "Failed", Description = "The request failed.")] Failed = 500 } diff --git a/src/Communication.Abstractions/Enums/SmsSendResponseCode.cs b/src/Communication/Communication.Abstractions/Enums/SmsSendResponseCode.cs similarity index 62% rename from src/Communication.Abstractions/Enums/SmsSendResponseCode.cs rename to src/Communication/Communication.Abstractions/Enums/SmsSendResponseCode.cs index 446ce9b6..0cf8afce 100644 --- a/src/Communication.Abstractions/Enums/SmsSendResponseCode.cs +++ b/src/Communication/Communication.Abstractions/Enums/SmsSendResponseCode.cs @@ -19,35 +19,54 @@ public enum SmsSendResponseCode /// /// The request was successful and the message has been queued for delivery. /// + [Display( + Name = "Success", + Description = "The request was successful and the message has been queued for delivery." + )] Success = 200, /// /// The request was successful and the message has been accepted to be queued for delivery. /// + [Display( + Name = "Accepted", + Description = "The request was successful and the message has been accepted to be queued for delivery." + )] Accepted = 250, /// /// There was a problem with the request, such as invalid parameters or authentication failure. /// + [Display( + Name = "Bad Request", + Description = "There was a problem with the request, such as invalid parameters or authentication failure." + )] BadRequest = 400, /// /// Authentication failure. The request requires authentication and the provided credentials were incorrect. /// + [Display( + Name = "Unauthorized", + Description = "Authentication failure. The request requires authentication and the provided credentials were incorrect." + )] Unauthorized = 401, /// /// Access to the requested resource is forbidden. /// + [Display(Name = "Forbidden", Description = "Access to the requested resource is forbidden.")] Forbidden = 403, /// /// The requested resource could not be found. /// + [Display(Name = "Not Found", Description = "The requested resource could not be found.")] NotFound = 404, /// /// An internal server error occurred. /// + [Display(Name = "Internal Server Error", Description = "An internal server error occurred.")] InternalServerError = 500 } diff --git a/src/Communication.Abstractions/IEmailSender.cs b/src/Communication/Communication.Abstractions/IEmailSender.cs similarity index 100% rename from src/Communication.Abstractions/IEmailSender.cs rename to src/Communication/Communication.Abstractions/IEmailSender.cs diff --git a/src/Communication.Abstractions/IMailSendResult.cs b/src/Communication/Communication.Abstractions/IMailSendResult.cs similarity index 100% rename from src/Communication.Abstractions/IMailSendResult.cs rename to src/Communication/Communication.Abstractions/IMailSendResult.cs diff --git a/src/Communication.Abstractions/IMessageSendResult.cs b/src/Communication/Communication.Abstractions/IMessageSendResult.cs similarity index 73% rename from src/Communication.Abstractions/IMessageSendResult.cs rename to src/Communication/Communication.Abstractions/IMessageSendResult.cs index 2987fb72..42f7f679 100644 --- a/src/Communication.Abstractions/IMessageSendResult.cs +++ b/src/Communication/Communication.Abstractions/IMessageSendResult.cs @@ -3,11 +3,11 @@ namespace Dgmjr.AspNetCore.Communication; public interface IMessageSendResult { bool IsSuccess { get; } - int StatusCode { get; init; } + int StatusCode { get; } } public interface IMessageSendResult : IMessageSendResult where TStatus : IIdentifiable { - TStatus Status { get; init; } + TStatus Status { get; } } diff --git a/src/Communication.Abstractions/ISmsSendResult.cs b/src/Communication/Communication.Abstractions/ISmsSendResult.cs similarity index 100% rename from src/Communication.Abstractions/ISmsSendResult.cs rename to src/Communication/Communication.Abstractions/ISmsSendResult.cs diff --git a/src/Communication.Abstractions/ISmsSender.cs b/src/Communication/Communication.Abstractions/ISmsSender.cs similarity index 100% rename from src/Communication.Abstractions/ISmsSender.cs rename to src/Communication/Communication.Abstractions/ISmsSender.cs diff --git a/src/Communication/Communication.Abstractions/LICENSE.md b/src/Communication/Communication.Abstractions/LICENSE.md new file mode 100644 index 00000000..4f592f86 --- /dev/null +++ b/src/Communication/Communication.Abstractions/LICENSE.md @@ -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:david@dgmjr.io "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. + diff --git a/src/Communication.Abstractions/MailSendResponseCode.cs b/src/Communication/Communication.Abstractions/MailSendResponseCode.cs similarity index 100% rename from src/Communication.Abstractions/MailSendResponseCode.cs rename to src/Communication/Communication.Abstractions/MailSendResponseCode.cs diff --git a/src/Communication.Abstractions/README.md b/src/Communication/Communication.Abstractions/README.md similarity index 100% rename from src/Communication.Abstractions/README.md rename to src/Communication/Communication.Abstractions/README.md diff --git a/src/Communication.Abstractions/SmsSendResponseCode.cs b/src/Communication/Communication.Abstractions/SmsSendResponseCode.cs similarity index 100% rename from src/Communication.Abstractions/SmsSendResponseCode.cs rename to src/Communication/Communication.Abstractions/SmsSendResponseCode.cs diff --git a/src/Communication/Communication.Abstractions/icon.png b/src/Communication/Communication.Abstractions/icon.png new file mode 100644 index 00000000..df642aaf Binary files /dev/null and b/src/Communication/Communication.Abstractions/icon.png differ diff --git a/src/Communication/Dgmjr.AspNetCore.Communication.sln b/src/Communication/Dgmjr.AspNetCore.Communication.sln deleted file mode 100644 index 7bacf8b5..00000000 --- a/src/Communication/Dgmjr.AspNetCore.Communication.sln +++ /dev/null @@ -1,56 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{B283EBC2-E01F-412D-9339-FD56EF114549}" - ProjectSection(SolutionItems) = preProject - ..\..\Directory.Build.props = ..\..\Directory.Build.props - ..\..\..\..\Directory.Build.targets = ..\..\..\..\Directory.Build.targets - ..\..\..\..\global.json = ..\..\..\..\global.json - ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props - EndProjectSection -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Communication.Abstractions", "..\Communication.Abstractions\Dgmjr.AspNetCore.Communication.Abstractions.csproj", "{A21EC7BB-E229-4D5F-98BE-194738D8505B}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Communication", "Dgmjr.AspNetCore.Communication.csproj", "{A6082934-C897-4FE1-85CA-AFBDB3EDE272}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Local|Any CPU = Local|Any CPU - Debug|Any CPU = Debug|Any CPU - Testing|Any CPU = Testing|Any CPU - Staging|Any CPU = Staging|Any CPU - Production|Any CPU = Production|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Local|Any CPU.ActiveCfg = Local|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Local|Any CPU.Build.0 = Local|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Testing|Any CPU.Build.0 = Testing|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Staging|Any CPU.Build.0 = Staging|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Production|Any CPU.ActiveCfg = Local|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Production|Any CPU.Build.0 = Local|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A21EC7BB-E229-4D5F-98BE-194738D8505B}.Release|Any CPU.Build.0 = Release|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Local|Any CPU.ActiveCfg = Local|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Local|Any CPU.Build.0 = Local|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Testing|Any CPU.Build.0 = Testing|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Staging|Any CPU.Build.0 = Staging|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Production|Any CPU.ActiveCfg = Local|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Production|Any CPU.Build.0 = Local|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A6082934-C897-4FE1-85CA-AFBDB3EDE272}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {209DE4E2-342E-4E9E-BC55-C75D87CD1B08} - EndGlobalSection -EndGlobal diff --git a/src/Communication/Sms/SmsSendResult.cs b/src/Communication/Sms/SmsSendResult.cs deleted file mode 100644 index 85fd33a6..00000000 --- a/src/Communication/Sms/SmsSendResult.cs +++ /dev/null @@ -1,37 +0,0 @@ -namespace Dgmjr.AspNetCore.Communication.Sms; - -/// -/// Represents the result of sending an SMS message. -/// -public readonly record struct SmsSendResult : ISmsSendResult -{ - public SmsSendResult(Azure.Communication.Sms.SmsSendResult result) - { - StatusCode = result.HttpStatusCode; - ErrorMessage = result.ErrorMessage; - To = (PhoneNumber)result.To; - } - - public string? ErrorMessage { get; init; } - public PhoneNumber To { get; init; } - - /// - /// Gets the status code of the message send result. - /// - public int StatusCode { get; init; } - - /// - /// Gets a value indicating whether the SMS message was sent successfully. - /// - public bool IsSuccess => - StatusCode is SmsSendResponseCode.Success.Id or SmsSendResponseCode.Accepted.Id; - - /// - /// Gets or sets the response code of the SMS send result. - /// - public Abstractions.ISmsSendResponseCode Status - { - get => SmsSendResponseCode.FromId(StatusCode); - init => StatusCode = ((IIdentifiable)value).Id; - } -} diff --git a/src/Configuration/Abstractions/IConfigureIHostApplicationBuilder.cs b/src/Configuration/Abstractions/IConfigureIHostApplicationBuilder.cs index c1bbc85b..fcea03da 100644 --- a/src/Configuration/Abstractions/IConfigureIHostApplicationBuilder.cs +++ b/src/Configuration/Abstractions/IConfigureIHostApplicationBuilder.cs @@ -1,7 +1,9 @@ namespace Dgmjr.Configuration.Extensions; + +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Hosting; public interface IConfigureIHostApplicationBuilder : IConfigureStuffInOrder { - void Configure(IHostApplicationBuilder builder); + void Configure(WebApplicationBuilder builder); } diff --git a/src/Configuration/Builder/WebApplicationBuilderFacade.cs b/src/Configuration/Builder/WebApplicationBuilderFacade.cs new file mode 100644 index 00000000..280e0fdf --- /dev/null +++ b/src/Configuration/Builder/WebApplicationBuilderFacade.cs @@ -0,0 +1,40 @@ +namespace Dgmjr.Configuration.Extensions.Builder; + +using System; +using System.Collections.Generic; + +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Diagnostics.Metrics; +using Microsoft.Extensions.Hosting; +using Microsoft.Extensions.Logging; + +internal class WebApplicationBuilderFacade(WebApplicationBuilder wrappedBuilder) + : IHostApplicationBuilder +{ + public IDictionary Properties { get; set; } + + public IConfigurationManager Configuration => wrappedBuilder.Configuration; + + public IHostEnvironment Environment => wrappedBuilder.Environment; + + public ILoggingBuilder Logging => wrappedBuilder.Logging; + + public IMetricsBuilder Metrics { get; set; } + + public IServiceCollection Services => wrappedBuilder.Services; + + public void ConfigureContainer( + IServiceProviderFactory factory, + Action? configure = null + ) + where TContainerBuilder : notnull + { + wrappedBuilder.Host.ConfigureContainer( + (ctx, builder) => configure(builder) + ); + } + + public IApplicationBuilder Build() => wrappedBuilder.Build(); +} diff --git a/src/Configuration/Configurators/JsonFileAutoConfigurator.cs b/src/Configuration/Configurators/JsonFileAutoConfigurator.cs index 3f91a022..a037d86f 100644 --- a/src/Configuration/Configurators/JsonFileAutoConfigurator.cs +++ b/src/Configuration/Configurators/JsonFileAutoConfigurator.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -7,7 +8,7 @@ public class JsonFileAutoConfigurator : IConfigureIHostApplicationBuilder { public ConfigurationOrder Order => ConfigurationOrder.VeryEarly; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.Configuration.AddKeyPerJsonFile( Path.Join(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Configuration") diff --git a/src/Configuration/DependencyInjection/AutoConfigureIApplicationHostBuilderExtensions.cs b/src/Configuration/DependencyInjection/AutoConfigureIApplicationHostBuilderExtensions.cs index 897838e8..3d5fd17f 100644 --- a/src/Configuration/DependencyInjection/AutoConfigureIApplicationHostBuilderExtensions.cs +++ b/src/Configuration/DependencyInjection/AutoConfigureIApplicationHostBuilderExtensions.cs @@ -2,6 +2,7 @@ namespace Microsoft.Extensions.DependencyInjection; using Dgmjr.Configuration.Extensions; +using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection.Extensions; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; @@ -10,9 +11,7 @@ namespace Microsoft.Extensions.DependencyInjection; public static class AutoConfigureIApplicationHostBuilderExtensions { - public static IHostApplicationBuilder AutoConfigure( - this IHostApplicationBuilder builder - ) + public static WebApplicationBuilder AutoConfigure(this WebApplicationBuilder builder) { builder.Configuration.AddKeyPerJsonFile( Path.Join(Path.GetDirectoryName(typeof(TProgram).Assembly.Location), "./Configuration/") diff --git a/src/Configuration/DependencyInjection/BuildIHostApplicationBuilderExtension.cs b/src/Configuration/DependencyInjection/BuildIHostApplicationBuilderExtension.cs new file mode 100644 index 00000000..f1a927bb --- /dev/null +++ b/src/Configuration/DependencyInjection/BuildIHostApplicationBuilderExtension.cs @@ -0,0 +1,13 @@ +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.Hosting; + +namespace Microsoft.Extensions.DependencyInjection; + +public static class BuildIHostApplicationBuilderExtension +{ + // public static IApplicationBuilder Build(this IHostApplicationBuilder builder) + // { + // IHostApplicationBuilder builder2 = WebApplication.CreateBuilder(["hello", "world"]); + // var app = (builder as WebApplicationBuilder).Build(); + // } +} diff --git a/src/Configuration/DependencyInjection/KeyPerJsonFileConfigurationExtensions.cs b/src/Configuration/DependencyInjection/KeyPerJsonFileConfigurationExtensions.cs index 830b61d2..c3341566 100644 --- a/src/Configuration/DependencyInjection/KeyPerJsonFileConfigurationExtensions.cs +++ b/src/Configuration/DependencyInjection/KeyPerJsonFileConfigurationExtensions.cs @@ -43,11 +43,13 @@ public static IConfigurationManager AddKeyPerJsonFile( $"Regenerated {AppSettings_Json} with {json.CountLines()} lines and {json.Length} bytes{env.NewLine}{json}" ); - config.AddJsonFile( - Path.Join(directory.FullName, "../" + AppSettings_Json), - false, - reloadOnChange - ); + config + .AddJsonFile( + Path.Join(directory.FullName, "../" + AppSettings_Json), + false, + reloadOnChange + ) + .AddSubstitution(); if (reloadOnChange) { ChangeToken.OnChange( diff --git a/src/Configuration/Dgmjr.Configuration.Extensions.sln b/src/Configuration/Dgmjr.Configuration.Extensions.sln index 1404e75d..1ce76b73 100644 --- a/src/Configuration/Dgmjr.Configuration.Extensions.sln +++ b/src/Configuration/Dgmjr.Configuration.Extensions.sln @@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Configuration.Extensions", "Dgmjr.Configuration.Extensions.csproj", "{7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Configuration.Extensions", "Dgmjr.Configuration.Extensions.csproj", "{FED7B3A9-134C-4C0A-B0D4-63932D688AEC}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -20,18 +20,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Local|Any CPU.ActiveCfg = Local|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Local|Any CPU.Build.0 = Local|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Testing|Any CPU.Build.0 = Testing|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Staging|Any CPU.Build.0 = Staging|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Production|Any CPU.ActiveCfg = Local|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Production|Any CPU.Build.0 = Local|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7731DAB8-2AD9-4208-9FAE-50FB445AF0D1}.Release|Any CPU.Build.0 = Release|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Local|Any CPU.ActiveCfg = Local|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Local|Any CPU.Build.0 = Local|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Testing|Any CPU.Build.0 = Testing|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Staging|Any CPU.Build.0 = Staging|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Production|Any CPU.ActiveCfg = Local|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Production|Any CPU.Build.0 = Local|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FED7B3A9-134C-4C0A-B0D4-63932D688AEC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Communication.Abstractions/icon.png b/src/Controllers.Abstractions/icon.png similarity index 100% rename from src/Communication.Abstractions/icon.png rename to src/Controllers.Abstractions/icon.png diff --git a/src/DownstreamApis/Dgmjr.Web.DownstreamApis.csproj b/src/DownstreamApis/Dgmjr.Web.DownstreamApis.csproj index dee055cb..7ca2ec25 100644 --- a/src/DownstreamApis/Dgmjr.Web.DownstreamApis.csproj +++ b/src/DownstreamApis/Dgmjr.Web.DownstreamApis.csproj @@ -1,3 +1,15 @@ + + 0eb63fc8-4d68-471c-bf25-ff7fbe57a33f @@ -15,6 +27,9 @@ + + + diff --git a/src/DownstreamApis/Dgmjr.Web.DownstreamApis.sln b/src/DownstreamApis/Dgmjr.Web.DownstreamApis.sln index 43e49a13..25059298 100644 --- a/src/DownstreamApis/Dgmjr.Web.DownstreamApis.sln +++ b/src/DownstreamApis/Dgmjr.Web.DownstreamApis.sln @@ -8,6 +8,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props EndProjectSection EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "..\Http\Mime\Dgmjr.Mime.csproj", "{6F24CF7B-856B-4A33-BF3C-783A45117FFA}" +EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Web.DownstreamApis", "Dgmjr.Web.DownstreamApis.csproj", "{0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}" EndProject Global @@ -20,6 +22,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Local|Any CPU.ActiveCfg = Local|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Local|Any CPU.Build.0 = Local|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Testing|Any CPU.Build.0 = Testing|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Staging|Any CPU.Build.0 = Staging|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Production|Any CPU.ActiveCfg = Local|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Production|Any CPU.Build.0 = Local|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6F24CF7B-856B-4A33-BF3C-783A45117FFA}.Release|Any CPU.Build.0 = Release|Any CPU {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Local|Any CPU.ActiveCfg = Local|Any CPU {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Local|Any CPU.Build.0 = Local|Any CPU {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU diff --git a/src/DownstreamApis/DownstreamApiOptionsConfigurator.cs b/src/DownstreamApis/DownstreamApiOptionsConfigurator.cs index 4b4d916b..2d2e8210 100644 --- a/src/DownstreamApis/DownstreamApiOptionsConfigurator.cs +++ b/src/DownstreamApis/DownstreamApiOptionsConfigurator.cs @@ -1,3 +1,15 @@ +/* + * DownstreamApiOptionsConfigurator.cs + * + * Created: 2023-06-27T00:06:27-05:00 + * Modified: 2024-15-28T14:15:43-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + namespace Dgmjr.Web.DownstreamApis; using Application = Dgmjr.Mime.Application; diff --git a/src/DownstreamApis/DownstreamApiServiceCollectionExtensions.cs b/src/DownstreamApis/DownstreamApiServiceCollectionExtensions.cs index 3606b750..9cf82086 100644 --- a/src/DownstreamApis/DownstreamApiServiceCollectionExtensions.cs +++ b/src/DownstreamApis/DownstreamApiServiceCollectionExtensions.cs @@ -1,4 +1,17 @@ +/* + * DownstreamApiServiceCollectionExtensions.cs + * + * Created: 2023-17-31T14:17:16-05:00 + * Modified: 2024-16-28T14:16:16-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + namespace Microsoft.Extensions.DependencyInjection; + using Microsoft.Extensions.Configuration; public static class DownstreamApiServiceCollectionExtensions @@ -32,21 +45,14 @@ IConfiguration configuration >(); return services; } + public static IServiceCollection ConfigureDownstreamApi( this IServiceCollection services, Action configureOptions - ) - => services.ConfigureDownstreamApi( - nameof(DownstreamApis), - configureOptions - ); + ) => services.ConfigureDownstreamApi(nameof(DownstreamApis), configureOptions); public static IServiceCollection ConfigureDownstreamApi( this IServiceCollection services, IConfiguration configuration - ) - => services.ConfigureDownstreamApi( - nameof(DownstreamApis), - configuration - ); + ) => services.ConfigureDownstreamApi(nameof(DownstreamApis), configuration); } diff --git a/src/DownstreamApis/DownstreamApis.cs b/src/DownstreamApis/DownstreamApis.cs index 36b02b5a..0d6ff40b 100644 --- a/src/DownstreamApis/DownstreamApis.cs +++ b/src/DownstreamApis/DownstreamApis.cs @@ -1,13 +1,22 @@ +/* + * DownstreamApis.cs + * + * Created: 2023-06-27T00:06:27-05:00 + * Modified: 2024-15-28T14:15:49-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + namespace Dgmjr.Web.DownstreamApis; using System.Collections; -public record class DownstreamApis : DownstreamApisBase, IDownstreamApis +public class DownstreamApis : Dictionary, IDownstreamApis { public const string MicrosoftGraphOptions = "MicrosoftGraph"; MicrosoftGraphOptions IDownstreamApis.MicrosoftGraph { get; set; } - - public IDictionary DownstreamApiOptions { get; set; } = - new Dictionary(); } diff --git a/src/DownstreamApis/DownstreamApisAutoConfigurator.cs b/src/DownstreamApis/DownstreamApisAutoConfigurator.cs index e52915ce..93d8c44e 100644 --- a/src/DownstreamApis/DownstreamApisAutoConfigurator.cs +++ b/src/DownstreamApis/DownstreamApisAutoConfigurator.cs @@ -1,3 +1,15 @@ +/* + * DownstreamApisAutoConfigurator.cs + * + * Created: 2024-10-20T10:10:10-05:00 + * Modified: 2024-15-28T14:15:56-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.Hosting; @@ -9,7 +21,7 @@ public class DownstreamApisAutoConfigurator { public ConfigurationOrder Order => ConfigurationOrder.AnyTime; - public void Configure(IHostApplicationBuilder builder) { } + public void Configure(WebApplicationBuilder builder) { } public void Configure(IApplicationBuilder app) { } } diff --git a/src/DownstreamApis/DownstreamApisBase.cs b/src/DownstreamApis/DownstreamApisBase.cs index 244fc1c6..69a24853 100644 --- a/src/DownstreamApis/DownstreamApisBase.cs +++ b/src/DownstreamApis/DownstreamApisBase.cs @@ -1,3 +1,15 @@ +/* + * DownstreamApisBase.cs + * + * Created: 2023-06-27T00:06:27-05:00 + * Modified: 2024-16-28T14:16:10-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + namespace Dgmjr.Web.DownstreamApis; public abstract record class DownstreamApisBase diff --git a/src/DownstreamApis/IDownstreamApis.cs b/src/DownstreamApis/IDownstreamApis.cs index 5e0e55c9..96cf99ea 100644 --- a/src/DownstreamApis/IDownstreamApis.cs +++ b/src/DownstreamApis/IDownstreamApis.cs @@ -1,3 +1,15 @@ +/* + * IDownstreamApis.cs + * + * Created: 2023-06-27T00:06:27-05:00 + * Modified: 2024-16-28T14:16:22-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + namespace Dgmjr.Web.DownstreamApis; /// diff --git a/src/DownstreamApis/JsonOptions.cs b/src/DownstreamApis/JsonOptions.cs index 2d8d3e56..3a6e098a 100644 --- a/src/DownstreamApis/JsonOptions.cs +++ b/src/DownstreamApis/JsonOptions.cs @@ -1,6 +1,18 @@ -namespace Microsoft.AspNetCore.Mvc; +/* + * JsonOptions.cs + * + * Created: 2023-06-27T00:06:27-05:00 + * Modified: 2024-15-28T14:15:18-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ #if !NET5_0_OR_GREATER +namespace Microsoft.AspNetCore.Mvc; + public class JsonOptions { /// diff --git a/src/Communication/icon.png b/src/Hosting.Extensions/icon.png similarity index 100% rename from src/Communication/icon.png rename to src/Hosting.Extensions/icon.png diff --git a/src/Http/CorrelationIdAutoConfigurator/CorrelationIdAutoConfigurator.cs b/src/Http/CorrelationIdAutoConfigurator/CorrelationIdAutoConfigurator.cs index 360f39b8..23368246 100644 --- a/src/Http/CorrelationIdAutoConfigurator/CorrelationIdAutoConfigurator.cs +++ b/src/Http/CorrelationIdAutoConfigurator/CorrelationIdAutoConfigurator.cs @@ -13,7 +13,7 @@ public class CorrelationIdAutoConfigurator { public ConfigurationOrder Order => ConfigurationOrder.VeryEarly; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.Services.AddDefaultCorrelationId( options => builder.Configuration.GetSection(nameof(CorrelationId)).Bind(options) diff --git a/src/Http/CorrelationIdAutoConfigurator/Dgmjr.Http.CorrelationId.cs b/src/Http/CorrelationIdAutoConfigurator/Dgmjr.Http.CorrelationId.cs new file mode 100644 index 00000000..689e4919 --- /dev/null +++ b/src/Http/CorrelationIdAutoConfigurator/Dgmjr.Http.CorrelationId.cs @@ -0,0 +1,15 @@ +/* + * Dgmjr.Http.CorrelationId.cs + * + * Created: 2024-36-29T08:36:42-05:00 + * Modified: 2024-36-29T08:36:42-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + +namespace Dgmjr.Http.CorrelationId; + +public class Foo { } diff --git a/src/Http/Mime/Dgmjr.Mime.csproj b/src/Http/Mime/Dgmjr.Mime.csproj index 12200945..ff87e447 100644 --- a/src/Http/Mime/Dgmjr.Mime.csproj +++ b/src/Http/Mime/Dgmjr.Mime.csproj @@ -12,10 +12,10 @@ - netstandard2.0 + Provides a set of constants for the most common media types. Fills in the gaps left by the class. true - constants diff --git a/src/Http/Mime/Dgmjr.Mime.sln b/src/Http/Mime/Dgmjr.Mime.sln index 91859dfc..0b073285 100644 --- a/src/Http/Mime/Dgmjr.Mime.sln +++ b/src/Http/Mime/Dgmjr.Mime.sln @@ -8,7 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\..\Packages\Versions.Local.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "Dgmjr.Mime.csproj", "{03655B61-669E-42F1-913F-C1D7BD387EEE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "Dgmjr.Mime.csproj", "{E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -20,18 +20,18 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Local|Any CPU.ActiveCfg = Local|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Local|Any CPU.Build.0 = Local|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Testing|Any CPU.Build.0 = Testing|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Staging|Any CPU.Build.0 = Staging|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Production|Any CPU.ActiveCfg = Local|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Production|Any CPU.Build.0 = Local|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {03655B61-669E-42F1-913F-C1D7BD387EEE}.Release|Any CPU.Build.0 = Release|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Local|Any CPU.ActiveCfg = Local|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Local|Any CPU.Build.0 = Local|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Testing|Any CPU.Build.0 = Testing|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Staging|Any CPU.Build.0 = Staging|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Production|Any CPU.ActiveCfg = Local|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Production|Any CPU.Build.0 = Local|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E1FF50FB-0ECD-4683-AAA1-9B6E3BD89745}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Http/ResponseCodes/ResponseCode.cs b/src/Http/ResponseCodes/ResponseCode.cs index 084abc39..7db3f69b 100644 --- a/src/Http/ResponseCodes/ResponseCode.cs +++ b/src/Http/ResponseCodes/ResponseCode.cs @@ -59,25 +59,25 @@ public enum StatusCode : ushort OK = 200, ///// The request has succeeded and a new resource has been created as a result. This is typically the response sent after a PUT request. - /// I created the thing for you. + /// Here. I created the thing for you. Are you fucking happy?! /// 201 /// [Display( Name = "Created", // Description = "The request has succeeded and a new resource has been created as a result. This is typically the response sent after a PUT request." - Description = "I created the thing for you." + Description = "Here. I created the thing for you. Are you fucking happy?!" )] [Uri($"{UriBase}201")] Created = 201, ///// The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing. - /// I got it and you can go do other stuff while I work on it for you. + /// I got it, I'm taking care of it, and you can go do other stuff while I work on it for you; don't wait for me. /// 202 /// [Display( Name = "Accepted", // Description = "The request has been received but not yet acted upon. It is non-committal, meaning that there is no way in HTTP to later send an asynchronous response indicating the outcome of processing the request. It is intended for cases where another process or server handles the request, or for batch processing." - Description = "I got it and you can go do other stuff while I work on it for you." + Description = "I got it, I'm taking care of it, and you can go do other stuff while I work on it for you; don't wait for me." )] [Uri($"{UriBase}202")] Accepted = 202, @@ -93,13 +93,15 @@ public enum StatusCode : ushort [Uri($"{UriBase}203")] NonAuthoritativeInformation = 203, - /// The server successfully processed the request and is not returning any content. + //// / The server successfully processed the request and is not returning any content. + /// I got it and I took care of it but I don't have anything else to say about it. /// 204 /// [Display( Name = "No Content", ShortName = "NoContent", - Description = "The server successfully processed the request and is not returning any content." + // Description = "The server successfully processed the request and is not returning any content." + Description = "I got it and I took care of it but I don't have anything else to say about it." )] [Uri($"{UriBase}204")] NoContent = 204, @@ -148,6 +150,16 @@ public enum StatusCode : ushort [Uri($"{UriBase}208")] AlreadyReported = 208, + /// Used by Apache servers. A catch-all error condition allowing the passage of message bodies through the server when the ProxyErrorOverride setting is enabled. It is displayed in this situation instead of a 4xx or 5xx error message. + /// 218 + /// + [Display( + Name = "This Is Fine", + Description = "Used by Apache servers. A catch-all error condition allowing the passage of message bodies through the server when the ProxyErrorOverride setting is enabled. It is displayed in this situation instead of a 4xx or 5xx error message." + )] + [Uri($"{UriBase}218")] + ThisIsFine = 218, + /// The server has fulfilled a request for the resource, and the response is a representation of the result of one or more instance-manipulations applied to the current instance. /// 226 /// @@ -168,22 +180,26 @@ public enum StatusCode : ushort [Uri($"{UriBase}300")] MultipleChoices = 300, - /// The URL of the requested resource has been changed permanently. This and all future requests should be directed to the given URI. + ///// The URL of the requested resource has been changed permanently. This and all future requests should be directed to the given URI. + /// The shit you're looking for ain't here any more. Look over here instead. /// 301 /// [Display( Name = "Moved Permanently", - Description = "The URL of the requested resource has been changed permanently. This and all future requests should be directed to the given URI." + // Description = "The URL of the requested resource has been changed permanently. This and all future requests should be directed to the given URI." + Description = "The shit you're looking for ain't here any more. Look over here instead." )] [Uri($"{UriBase}301")] MovedPermanently = 301, - /// Tells the client to look at (browse to) another URL. The HTTP/1.0 specification required the client to perform a temporary redirect with the same method (the original describing phrase was "Moved Temporarily"),[9] but popular browsers implemented 302 redirects by changing the method to GET. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviors. + ///// Tells the client to look at (browse to) another URL. The HTTP/1.0 specification required the client to perform a temporary redirect with the same method (the original describing phrase was "Moved Temporarily"),[9] but popular browsers implemented 302 redirects by changing the method to GET. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviors. + /// The shit you're looking for has been moved, but it might move back so don't remember this redirection. Just do it this once and keep asking me whenever you want the shit that you asked for. /// 302 /// [Display( Name = "Found", - Description = "Tells the client to look at (browse to) another URL. The HTTP/1.0 specification required the client to perform a temporary redirect with the same method (the original describing phrase was \\\"Moved Temporarily\\\"), but popular browsers implemented 302 redirects by changing the method to GET. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviors." + // Description = "Tells the client to look at (browse to) another URL. The HTTP/1.0 specification required the client to perform a temporary redirect with the same method (the original describing phrase was \\\"Moved Temporarily\\\"), but popular browsers implemented 302 redirects by changing the method to GET. Therefore, HTTP/1.1 added status codes 303 and 307 to distinguish between the two behaviors." + Description = "The shit you're looking for has been moved, but it might move back so don't remember this redirection. Just do it this once and keep asking me whenever you want the shit that you asked for." )] [Uri($"{UriBase}302")] Found = 302, @@ -198,12 +214,14 @@ public enum StatusCode : ushort [Uri($"{UriBase}303")] SeeOther = 303, - /// Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy. + ///// Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy. + /// Nothing's new; you can use the copy that you already have. /// 304 /// [Display( Name = "Not Modified", - Description = "Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy." + // Description = "Indicates that the resource has not been modified since the version specified by the request headers If-Modified-Since or If-None-Match. In such case, there is no need to retransmit the resource since the client still has a previously-downloaded copy." + Description = "Nothing's new; you can use the copy that you already have." )] [Uri($"{UriBase}304")] NotModified = 304, @@ -248,12 +266,13 @@ public enum StatusCode : ushort [Uri($"{UriBase}308")] PermanentRedirect = 308, - /// The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing). + /// You dumb fuck! /// 400 /// [Display( Name = "Bad Request", - Description = "The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing)." + // Description = "The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, size too large, invalid request message framing, or deceptive request routing)." + Description = "You dumb fuck!" )] [Uri($"{UriBase}400")] BadRequest = 400, @@ -438,6 +457,26 @@ public enum StatusCode : ushort [Uri($"{UriBase}418")] ImATeapot = 418, + /// Used by the Laravel Framework when a CSRF Token is missing or expired. + /// 419 + /// + [Display( + Name = "Page Expired", + Description = "Used by the Laravel Framework when a CSRF Token is missing or expired." + )] + [Uri($"{UriBase}419")] + PageExpired = 419, + + /// Returned by version 1 of the Twitter Search and Trends API when the client is being rate limited; versions 1.1 and later use the 429 Too Many Requests response code instead. The phrase "Enhance your calm" comes from the 1993 movie Demolition Man, and its association with this number is likely a reference to cannabis. + /// 420 + /// + [Display( + Name = "Enhance Your Calm", + Description = "Returned by version 1 of the Twitter Search and Trends API when the client is being rate limited; versions 1.1 and later use the 429 Too Many Requests response code instead. The phrase \\\"Enhance your calm\\\" comes from the 1993 movie Demolition Man, and its association with this number is likely a reference to cannabis." + )] + [Uri($"{UriBase}420")] + EnhanceYourCalm = 420, + /// The request was directed at a server that is not able to produce a response (for example because of connection reuse). /// 421 /// @@ -515,6 +554,16 @@ public enum StatusCode : ushort [Uri($"{UriBase}431")] RequestHeaderFieldsTooLarge = 431, + /// Used in Exchange ActiveSync if there either is a more efficient server to use or the server cannot access the users' mailbox.[citation needed] + /// 449 + /// + [Display( + Name = "Retry With", + Description = "Used in Exchange ActiveSync if there either is a more efficient server to use or the server cannot access the users' mailbox." + )] + [Uri($"{UriBase}449")] + RetryWith = 449, + /// A server operator has received a legal demand to deny access to a resource or to a set of resources that includes the requested resource.[60] The code 451 was chosen as a reference to the novel Fahrenheit 451 (see the Acknowledgements in the RFC). /// 451 /// @@ -525,6 +574,36 @@ public enum StatusCode : ushort [Uri($"{UriBase}451")] UnavailableForLegalReasons = 451, + /// A Microsoft extension. The request should be retried after performing the appropriate action. + /// 451 + /// + [Display( + Name = "Redirect", + Description = "A Microsoft extension. The request should be retried after performing the appropriate action." + )] + [Uri($"{UriBase}451")] + Redirect = 451, + + /// Returned by ArcGIS for Server. A code of 498 indicates an expired or otherwise invalid token. + /// 498 + /// + [Display( + Name = "Invalid Token", + Description = "Returned by ArcGIS for Server. A code of 498 indicates an expired or otherwise invalid token." + )] + [Uri($"{UriBase}498")] + InvalidToken = 498, + + /// Returned by ArcGIS for Server. A code of 499 indicates that a token is required (if no token was submitted). + /// 499 + /// + [Display( + Name = "Token Required", + Description = "Returned by ArcGIS for Server. A code of 499 indicates that a token is required (if no token was submitted)." + )] + [Uri($"{UriBase}499")] + TokenRequired = 499, + /// A generic error message, given when an unexpected condition was encountered and no more specific message is suitable. /// 500 /// @@ -734,75 +813,5 @@ public enum StatusCode : ushort Description = "This status code is not specified in any RFCs, but is used by CloudFlare's reverse proxies to signal an \\\"unknown connection issue between CloudFlare and the origin web server\\\" to a client in front of the proxy." )] [Uri($"{UriBase}530")] - SiteIsFrozen = 530, - - /// Used by Apache servers. A catch-all error condition allowing the passage of message bodies through the server when the ProxyErrorOverride setting is enabled. It is displayed in this situation instead of a 4xx or 5xx error message. - /// 218 - /// - [Display( - Name = "This Is Fine", - Description = "Used by Apache servers. A catch-all error condition allowing the passage of message bodies through the server when the ProxyErrorOverride setting is enabled. It is displayed in this situation instead of a 4xx or 5xx error message." - )] - [Uri($"{UriBase}218")] - ThisIsFine = 218, - - /// Used by the Laravel Framework when a CSRF Token is missing or expired. - /// 419 - /// - [Display( - Name = "Page Expired", - Description = "Used by the Laravel Framework when a CSRF Token is missing or expired." - )] - [Uri($"{UriBase}419")] - PageExpired = 419, - - /// Returned by version 1 of the Twitter Search and Trends API when the client is being rate limited; versions 1.1 and later use the 429 Too Many Requests response code instead. The phrase "Enhance your calm" comes from the 1993 movie Demolition Man, and its association with this number is likely a reference to cannabis. - /// 420 - /// - [Display( - Name = "Enhance Your Calm", - Description = "Returned by version 1 of the Twitter Search and Trends API when the client is being rate limited; versions 1.1 and later use the 429 Too Many Requests response code instead. The phrase \\\"Enhance your calm\\\" comes from the 1993 movie Demolition Man, and its association with this number is likely a reference to cannabis." - )] - [Uri($"{UriBase}420")] - EnhanceYourCalm = 420, - - /// Returned by ArcGIS for Server. A code of 498 indicates an expired or otherwise invalid token. - /// 498 - /// - [Display( - Name = "Invalid Token", - Description = "Returned by ArcGIS for Server. A code of 498 indicates an expired or otherwise invalid token." - )] - [Uri($"{UriBase}498")] - InvalidToken = 498, - - /// Returned by ArcGIS for Server. A code of 499 indicates that a token is required (if no token was submitted). - /// 499 - /// - [Display( - Name = "Token Required", - Description = "Returned by ArcGIS for Server. A code of 499 indicates that a token is required (if no token was submitted)." - )] - [Uri($"{UriBase}499")] - TokenRequired = 499, - - /// Used in Exchange ActiveSync if there either is a more efficient server to use or the server cannot access the users' mailbox.[citation needed] - /// 449 - /// - [Display( - Name = "Retry With", - Description = "Used in Exchange ActiveSync if there either is a more efficient server to use or the server cannot access the users' mailbox." - )] - [Uri($"{UriBase}449")] - RetryWith = 449, - - /// A Microsoft extension. The request should be retried after performing the appropriate action. - /// 451 - /// - [Display( - Name = "Redirect", - Description = "A Microsoft extension. The request should be retried after performing the appropriate action." - )] - [Uri($"{UriBase}451")] - Redirect = 451 + SiteIsFrozen = 530 } diff --git a/src/Http/Services/HttpServicesExtensions.AddHttpServices.cs b/src/Http/Services/HttpServicesExtensions.AddHttpServices.cs index 4979fa2b..dbe1b6cd 100644 --- a/src/Http/Services/HttpServicesExtensions.AddHttpServices.cs +++ b/src/Http/Services/HttpServicesExtensions.AddHttpServices.cs @@ -25,8 +25,8 @@ public static partial class HttpServicesExtensions public const string Kestrel = nameof(Kestrel); public const string ExceptionHandling = nameof(ExceptionHandling); - public static IHostApplicationBuilder AddHttpServices( - this IHostApplicationBuilder builder, + public static WebApplicationBuilder AddHttpServices( + this WebApplicationBuilder builder, string configurationSectionKey = Http ) { diff --git a/src/Http/Services/HttpServicesOptionsAutoConfigurator.cs b/src/Http/Services/HttpServicesOptionsAutoConfigurator.cs index 398b4152..1cbe81c4 100644 --- a/src/Http/Services/HttpServicesOptionsAutoConfigurator.cs +++ b/src/Http/Services/HttpServicesOptionsAutoConfigurator.cs @@ -10,7 +10,7 @@ public class HttpServicesOptionsAutoConfigurator { public ConfigurationOrder Order => ConfigurationOrder.AnyTime; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.AddHttpServices(); } diff --git a/src/MicrosoftGraph/Configuration/MicrosoftGraphAutoConfigurator.cs b/src/MicrosoftGraph/Configuration/MicrosoftGraphAutoConfigurator.cs index 5dac62aa..2b7916fe 100644 --- a/src/MicrosoftGraph/Configuration/MicrosoftGraphAutoConfigurator.cs +++ b/src/MicrosoftGraph/Configuration/MicrosoftGraphAutoConfigurator.cs @@ -4,7 +4,7 @@ public class MicrosoftGraphAutoConfigurator : IConfigureIHostApplicationBuilder { public ConfigurationOrder Order => ConfigurationOrder.AnyTime; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.Services.AddMicrosoftGraph(builder.Configuration); } diff --git a/src/MicrosoftGraph/Dgmjr.Graph.csproj b/src/MicrosoftGraph/Dgmjr.Graph.csproj index 178196dd..b19f76f1 100644 --- a/src/MicrosoftGraph/Dgmjr.Graph.csproj +++ b/src/MicrosoftGraph/Dgmjr.Graph.csproj @@ -7,7 +7,7 @@ - + @@ -32,7 +32,7 @@ - + diff --git a/src/MicrosoftGraph/Dgmjr.Graph.props b/src/MicrosoftGraph/Dgmjr.Graph.props index 444162ac..e67d6714 100644 --- a/src/MicrosoftGraph/Dgmjr.Graph.props +++ b/src/MicrosoftGraph/Dgmjr.Graph.props @@ -4,7 +4,7 @@ - + diff --git a/src/MicrosoftGraph/Dgmjr.Graph.sln b/src/MicrosoftGraph/Dgmjr.Graph.sln index 4d8b5f91..39551486 100644 --- a/src/MicrosoftGraph/Dgmjr.Graph.sln +++ b/src/MicrosoftGraph/Dgmjr.Graph.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Web.DownstreamApis", "..\DownstreamApis\Dgmjr.Web.DownstreamApis.csproj", "{0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Graph", "Dgmjr.Graph.csproj", "{137D8567-6811-417D-B62F-B0980EB5C5D7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Graph", "Dgmjr.Graph.csproj", "{0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,18 +34,18 @@ Global {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Production|Any CPU.Build.0 = Local|Any CPU {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Release|Any CPU.ActiveCfg = Release|Any CPU {0EB63FC8-4D68-471C-BF25-FF7FBE57A33F}.Release|Any CPU.Build.0 = Release|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Local|Any CPU.ActiveCfg = Local|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Local|Any CPU.Build.0 = Local|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Testing|Any CPU.Build.0 = Testing|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Staging|Any CPU.Build.0 = Staging|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Production|Any CPU.ActiveCfg = Local|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Production|Any CPU.Build.0 = Local|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {137D8567-6811-417D-B62F-B0980EB5C5D7}.Release|Any CPU.Build.0 = Release|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Local|Any CPU.ActiveCfg = Local|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Local|Any CPU.Build.0 = Local|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Testing|Any CPU.Build.0 = Testing|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Staging|Any CPU.Build.0 = Staging|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Production|Any CPU.ActiveCfg = Local|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Production|Any CPU.Build.0 = Local|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F27DFD4-7490-4E35-BA32-7D2B44EC3C13}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/MicrosoftGraph/Extensions/LoggingExtensions.cs b/src/MicrosoftGraph/Extensions/LoggingExtensions.cs index b4997606..050e9f9c 100644 --- a/src/MicrosoftGraph/Extensions/LoggingExtensions.cs +++ b/src/MicrosoftGraph/Extensions/LoggingExtensions.cs @@ -1,24 +1,48 @@ -// namespace Dgmjr.Graph; +using System.Security.Claims; -// internal static partial class LoggingExtensions -// { -// [LoggerMessage( -// EventId = 1, -// Level = LogLevel.Information, -// Message = "{Method} {Path}", -// EventName = nameof(PageVisited) -// )] -// public static partial void PageVisited( -// this ILogger logger, -// System.Net.Http.HttpMethod method, -// string path -// ); +namespace Dgmjr.Graph; -// [LoggerMessage( -// EventId = 1, -// Level = LogLevel.Information, -// Message = "{Method} {Path}", -// EventName = nameof(PageVisited) -// )] -// public static partial void PageVisited(this ILogger logger, string method, string path); -// } +internal static partial class LoggingExtensions +{ + [LoggerMessage( + EventId = 1, + Level = LogLevel.Information, + Message = "Beginning supplementary token acquisition and creation for user {User}", + EventName = nameof(BeginningSupplementaryTokenAcquisitionAndCreation) + )] + public static partial void BeginningSupplementaryTokenAcquisitionAndCreation( + this ILogger logger, + ClaimsPrincipal user + ); + + [LoggerMessage( + EventId = 2, + Level = LogLevel.Information, + Message = "Supplementary token acquisition and creation for user {User} completed", + EventName = nameof(SupplementaryTokenAcquisitionAndCreationComplete) + )] + public static partial void SupplementaryTokenAcquisitionAndCreationComplete( + this ILogger logger, + ClaimsPrincipal user + ); + + // [LoggerMessage( + // EventId = 1, + // Level = LogLevel.Information, + // Message = "{Method} {Path}", + // EventName = nameof(PageVisited) + // )] + // public static partial void PageVisited( + // this ILogger logger, + // System.Net.Http.HttpMethod method, + // string path + // ); + + // [LoggerMessage( + // EventId = 1, + // Level = LogLevel.Information, + // Message = "{Method} {Path}", + // EventName = nameof(PageVisited) + // )] + // public static partial void PageVisited(this ILogger logger, string method, string path); +} diff --git a/src/MicrosoftGraph/Extensions/MicrosoftGraphServiceCollectionExtensions.cs b/src/MicrosoftGraph/Extensions/MicrosoftGraphServiceCollectionExtensions.cs index 924d189d..f804222a 100644 --- a/src/MicrosoftGraph/Extensions/MicrosoftGraphServiceCollectionExtensions.cs +++ b/src/MicrosoftGraph/Extensions/MicrosoftGraphServiceCollectionExtensions.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authentication.OpenIdConnect; using Dgmjr.Graph.TokenProviders; using IAuthenticationProvider = Microsoft.Graph.IAuthenticationProvider; +using Microsoft.ApplicationInsights; namespace Microsoft.Extensions.DependencyInjection; @@ -15,15 +16,15 @@ IConfiguration config ) { var configSection = config.GetSection(DownstreamApis_MicrosoftGraph); - var options = configSection.Get(); + var options = configSection.Get(); services .AddMicrosoftGraph(options => config.Bind(options)) .AddMicrosoftIdentityConsentHandler() .ConfigureDownstreamApi(MicrosoftGraph, configSection); services.AddScoped(); - services.Configure(configSection); + services.Configure(configSection); services.AddScoped(); - services.Configure(options => + services.ConfigureAll(options => { options.Events.OnTokenValidated = OnTokenValidated; }); @@ -45,9 +46,19 @@ IConfiguration config private static async Task OnTokenValidated(TokenValidatedContext context) { - var services = context.HttpContext.RequestServices; + using var scope = context.HttpContext.RequestServices.CreateScope(); + using var activity = Dgmjr.Graph.Telemetry.Activities.TokenAcquisitionActivitySource.StartActivity( + nameof(OnTokenValidated), + ActivityKind.Client + ); + var logger = scope.ServiceProvider.GetRequiredService>(); + logger.BeginningSupplementaryTokenAcquisitionAndCreation(context.Principal); + activity.AddTag("UserObjectId", context.Principal.GetObjectId()); + activity.AddTag("UserTenantId", context.Principal.GetTenantId()); + + var services = scope.ServiceProvider; var tokenAcquisition = services.GetRequiredService(); - var graphClientOptions = services.GetRequiredService>().Value; + var graphClientOptions = services.GetRequiredService>().Value; var graphClient = new GraphServiceClient( new BaseBearerTokenAuthenticationProvider( @@ -71,5 +82,6 @@ private static async Task OnTokenValidated(TokenValidatedContext context) claims.Add(new(ClaimTypes.Role, theAppRole.Value)); } } + logger.SupplementaryTokenAcquisitionAndCreationComplete(context.Principal); } } diff --git a/src/MicrosoftGraph/Options/MicrosoftGraphOptions.cs b/src/MicrosoftGraph/Options/MicrosoftGraphOptions.cs index a555f367..37309f0f 100644 --- a/src/MicrosoftGraph/Options/MicrosoftGraphOptions.cs +++ b/src/MicrosoftGraph/Options/MicrosoftGraphOptions.cs @@ -1,9 +1,9 @@ namespace Dgmjr.Graph.Options; -public class MicrosoftB2CGraphOptions : Microsoft.Identity.Web.MicrosoftGraphOptions +public class AzureAdB2CGraphOptions : Microsoft.Identity.Web.MicrosoftGraphOptions { /// MicrosoftGraphOptions - public const string AppSettingsKey = nameof(MicrosoftB2CGraphOptions); + public const string AppSettingsKey = nameof(AzureAdB2CGraphOptions); /// The of the Azure AD B2C extensions application public guid AzureAdB2CExtensionsApplicationId { get; set; } diff --git a/src/MicrosoftGraph/Services/ApplicationService.cs b/src/MicrosoftGraph/Services/ApplicationService.cs index a2437f38..12a04179 100644 --- a/src/MicrosoftGraph/Services/ApplicationService.cs +++ b/src/MicrosoftGraph/Services/ApplicationService.cs @@ -1,5 +1,9 @@ namespace Dgmjr.Graph.Services; -public class ApplicationService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : MsGraphService(graph, logger, options, msidOptions, cache), IApplicationService -{ -} +public class ApplicationService( + GraphServiceClient graph, + ILogger logger, + IOptionsMonitor options, + IOptionsMonitor msidOptions, + IDistributedCache cache +) : MsGraphService(graph, logger, options, msidOptions, cache), IApplicationService { } diff --git a/src/MicrosoftGraph/Services/DirectoryObjectsService.cs b/src/MicrosoftGraph/Services/DirectoryObjectsService.cs index f58ad8a8..cc86fb1c 100644 --- a/src/MicrosoftGraph/Services/DirectoryObjectsService.cs +++ b/src/MicrosoftGraph/Services/DirectoryObjectsService.cs @@ -1,18 +1,37 @@ namespace Dgmjr.Graph.Services; -public class DirectoryObjectsService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : MsGraphService(graph, logger, options, msidOptions, cache), IDirectoryObjectsService +public class DirectoryObjectsService( + GraphServiceClient graph, + ILogger logger, + IOptionsMonitor options, + IOptionsMonitor msidOptions, + IDistributedCache cache +) : MsGraphService(graph, logger, options, msidOptions, cache), IDirectoryObjectsService { - public async Task GetAsync(string id, CancellationToken cancellationToken = default) + public async Task GetAsync( + string id, + CancellationToken cancellationToken = default + ) { return await Graph.DirectoryObjects[id].Request().GetAsync(cancellationToken); } - public async Task GetAsync(string id, string property, CancellationToken cancellationToken = default) + public async Task GetAsync( + string id, + string property, + CancellationToken cancellationToken = default + ) { - return await Graph.DirectoryObjects[id].Request().Select(property).GetAsync(cancellationToken); + return await Graph.DirectoryObjects[id] + .Request() + .Select(property) + .GetAsync(cancellationToken); } - public async Task CreateAsync(DirectoryObject directoryObject, CancellationToken cancellationToken = default) + public async Task CreateAsync( + DirectoryObject directoryObject, + CancellationToken cancellationToken = default + ) { return await Graph.DirectoryObjects.Request().AddAsync(directoryObject, cancellationToken); } @@ -22,8 +41,14 @@ public async Task DeleteAsync(string id, CancellationToken cancellationToken = d await Graph.DirectoryObjects[id].Request().DeleteAsync(cancellationToken); } - public async Task UpdateAsync(string id, DirectoryObject directoryObject, CancellationToken cancellationToken = default) + public async Task UpdateAsync( + string id, + DirectoryObject directoryObject, + CancellationToken cancellationToken = default + ) { - return await Graph.DirectoryObjects[id].Request().UpdateAsync(directoryObject, cancellationToken); + return await Graph.DirectoryObjects[id] + .Request() + .UpdateAsync(directoryObject, cancellationToken); } } diff --git a/src/MicrosoftGraph/Services/MsGraphService.cs b/src/MicrosoftGraph/Services/MsGraphService.cs index a42ea2e0..3c00e56d 100644 --- a/src/MicrosoftGraph/Services/MsGraphService.cs +++ b/src/MicrosoftGraph/Services/MsGraphService.cs @@ -22,12 +22,12 @@ public interface IMsGraphService : IHaveAGraphClient Task GetExtensionsApplicationAsync(); } -public class MsGraphService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : IMsGraphService +public class MsGraphService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : IMsGraphService { private static readonly duration CacheDuration = duration.FromDays(1000); private static readonly DateTimeOffset CacheExpiration = DateTimeOffset.UtcNow.Add(CacheDuration); public ILogger Logger => logger; - private MicrosoftB2CGraphOptions Options => options.CurrentValue; + private AzureAdB2CGraphOptions Options => options.CurrentValue; private MicrosoftIdentityOptions MsidOptions => msidOptions.CurrentValue; public guid ExtensionsAppClientId => Options.AzureAdB2CExtensionsApplicationId; public guid ClientId => new(MsidOptions.ClientId); diff --git a/src/MicrosoftGraph/Services/UsersService.cs b/src/MicrosoftGraph/Services/UsersService.cs index de3739ca..1090f5f2 100644 --- a/src/MicrosoftGraph/Services/UsersService.cs +++ b/src/MicrosoftGraph/Services/UsersService.cs @@ -1,6 +1,6 @@ namespace Dgmjr.Graph.Services; -public class UsersService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : MsGraphService(graph, logger, options, msidOptions, cache), IUsersService +public class UsersService(GraphServiceClient graph, ILogger logger, IOptionsMonitor options, IOptionsMonitor msidOptions, IDistributedCache cache) : MsGraphService(graph, logger, options, msidOptions, cache), IUsersService { public async Task GetMeAsync(CancellationToken cancellationToken = default) { diff --git a/src/MicrosoftGraph/Telemetry/Activities.cs b/src/MicrosoftGraph/Telemetry/Activities.cs index 0d68b163..d7d19513 100644 --- a/src/MicrosoftGraph/Telemetry/Activities.cs +++ b/src/MicrosoftGraph/Telemetry/Activities.cs @@ -16,6 +16,8 @@ public static class Activities { private static readonly Version AssemblyVersion = typeof(Activities).Assembly.GetName().Version; + public static readonly ActivitySource ActivitySource = new(TraceNames.Basic, ServiceVersion); + /// /// Base ActivitySource /// @@ -46,6 +48,12 @@ public static class Activities public static readonly ActivitySource ValidationActivitySource = new(TraceNames.Validation, ServiceVersion); + /// + /// Detailed validation ActivitySource + /// + public static readonly ActivitySource TokenAcquisitionActivitySource = + new(TraceNames.TokenAcquisition, ServiceVersion); + /// /// Service version /// @@ -63,22 +71,27 @@ public static class TraceNames /// /// Service name for store traces /// - public const string Store = Basic + ".Stores"; + public const string Store = Basic + "." + nameof(Store) + "s"; /// /// Service name for caching traces /// - public const string Cache = Basic + ".Cache"; + public const string Cache = Basic + "." + nameof(Cache); /// /// Service name for caching traces /// - public const string Services = Basic + ".Services"; + public const string Services = Basic + "." + nameof(Services); /// /// Service name for detailed validation traces /// - public const string Validation = Basic + ".Validation"; + public const string Validation = Basic + nameof(Validation); + + /// + /// Service name for detailed token acquisition traces + /// + public const string TokenAcquisition = Basic + "." + nameof(TokenAcquisition); public static readonly string ServiceVersion = Activities.ServiceVersion; } diff --git a/src/Middleware/RequestLogging/icon.png b/src/Middleware/RequestLogging/icon.png new file mode 100644 index 00000000..db07a039 Binary files /dev/null and b/src/Middleware/RequestLogging/icon.png differ diff --git a/src/Mvc/Dgmjr.AspNetCore.Mvc.csproj b/src/Mvc/Dgmjr.AspNetCore.Mvc.csproj index 1be89698..845a91f3 100644 --- a/src/Mvc/Dgmjr.AspNetCore.Mvc.csproj +++ b/src/Mvc/Dgmjr.AspNetCore.Mvc.csproj @@ -25,7 +25,7 @@ - + diff --git a/src/Mvc/Dgmjr.AspNetCore.Mvc.sln b/src/Mvc/Dgmjr.AspNetCore.Mvc.sln index 6ebbbbb5..783bd627 100644 --- a/src/Mvc/Dgmjr.AspNetCore.Mvc.sln +++ b/src/Mvc/Dgmjr.AspNetCore.Mvc.sln @@ -8,11 +8,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "..\Http\Mime\Dgmjr.Mime.csproj", "{0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "..\Http\Mime\Dgmjr.Mime.csproj", "{FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Http.StatusCodes", "..\Http\ResponseCodes\Dgmjr.Http.StatusCodes.csproj", "{255F91DE-EF50-457A-8688-C526FD2BF0F4}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Http.StatusCodes", "..\Http\ResponseCodes\Dgmjr.Http.StatusCodes.csproj", "{86A9240C-CB92-4EC7-9C82-ACC429BAD774}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Mvc", "Dgmjr.AspNetCore.Mvc.csproj", "{8494B973-A402-4F9B-8262-72DA92DA74D7}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Mvc", "Dgmjr.AspNetCore.Mvc.csproj", "{75CCEE17-7ED6-4DAD-85E8-971722052B7F}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -24,42 +24,42 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Local|Any CPU.ActiveCfg = Local|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Local|Any CPU.Build.0 = Local|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Testing|Any CPU.Build.0 = Testing|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Staging|Any CPU.Build.0 = Staging|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Production|Any CPU.ActiveCfg = Local|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Production|Any CPU.Build.0 = Local|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F9518CF-E1E7-4697-BF2D-1C3FE4D285ED}.Release|Any CPU.Build.0 = Release|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Local|Any CPU.ActiveCfg = Local|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Local|Any CPU.Build.0 = Local|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Testing|Any CPU.Build.0 = Testing|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Staging|Any CPU.Build.0 = Staging|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Production|Any CPU.ActiveCfg = Local|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Production|Any CPU.Build.0 = Local|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {255F91DE-EF50-457A-8688-C526FD2BF0F4}.Release|Any CPU.Build.0 = Release|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Local|Any CPU.ActiveCfg = Local|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Local|Any CPU.Build.0 = Local|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Testing|Any CPU.Build.0 = Testing|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Staging|Any CPU.Build.0 = Staging|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Production|Any CPU.ActiveCfg = Local|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Production|Any CPU.Build.0 = Local|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8494B973-A402-4F9B-8262-72DA92DA74D7}.Release|Any CPU.Build.0 = Release|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Local|Any CPU.ActiveCfg = Local|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Local|Any CPU.Build.0 = Local|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Testing|Any CPU.Build.0 = Testing|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Staging|Any CPU.Build.0 = Staging|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Production|Any CPU.ActiveCfg = Local|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Production|Any CPU.Build.0 = Local|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FD4A80E2-D49C-4E08-B0A0-A4F99CEE64D6}.Release|Any CPU.Build.0 = Release|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Local|Any CPU.ActiveCfg = Local|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Local|Any CPU.Build.0 = Local|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Debug|Any CPU.Build.0 = Debug|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Testing|Any CPU.Build.0 = Testing|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Staging|Any CPU.Build.0 = Staging|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Production|Any CPU.ActiveCfg = Local|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Production|Any CPU.Build.0 = Local|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Release|Any CPU.ActiveCfg = Release|Any CPU + {86A9240C-CB92-4EC7-9C82-ACC429BAD774}.Release|Any CPU.Build.0 = Release|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Local|Any CPU.ActiveCfg = Local|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Local|Any CPU.Build.0 = Local|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Testing|Any CPU.Build.0 = Testing|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Staging|Any CPU.Build.0 = Staging|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Production|Any CPU.ActiveCfg = Local|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Production|Any CPU.Build.0 = Local|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75CCEE17-7ED6-4DAD-85E8-971722052B7F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Mvc/IHostApplicationBuilderMvcExtensions.cs b/src/Mvc/IHostApplicationBuilderMvcExtensions.cs index 30d53519..5539b8e5 100644 --- a/src/Mvc/IHostApplicationBuilderMvcExtensions.cs +++ b/src/Mvc/IHostApplicationBuilderMvcExtensions.cs @@ -15,8 +15,8 @@ public static class IHostApplicationBuilderMvcExtensions private const string Mvc = nameof(Mvc); private const string JsonSerializer = nameof(JsonSerializer); - public static IHostApplicationBuilder AddMvc( - this IHostApplicationBuilder builder, + public static WebApplicationBuilder AddMvc( + this WebApplicationBuilder builder, string configurationSectionKey = Mvc ) { diff --git a/src/Mvc/MvcAutoConfigurator.cs b/src/Mvc/MvcAutoConfigurator.cs index 7613542a..01a2f0ed 100644 --- a/src/Mvc/MvcAutoConfigurator.cs +++ b/src/Mvc/MvcAutoConfigurator.cs @@ -10,7 +10,7 @@ public class MvcAutoConfigurator : IConfigureIHostApplicationBuilder, IConfigure private const string JsonSerializer = nameof(JsonSerializer); public ConfigurationOrder Order => ConfigurationOrder.AnyTime; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.AddMvc(); } diff --git a/src/Mvc/MvcOptions.cs b/src/Mvc/MvcOptions.cs index af10fc8d..916fd53e 100644 --- a/src/Mvc/MvcOptions.cs +++ b/src/Mvc/MvcOptions.cs @@ -1,14 +1,133 @@ +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.ApplicationModels; + namespace Dgmjr.AspNetCore.Mvc; public class MvcOptions : Microsoft.AspNetCore.Mvc.MvcOptions { + /// if you want to add controllers with views, otherwise public bool AddControllersWithViews { get; set; } = false; + + /// if you want to add controllers with views, otherwise public bool AddRazorPages { get; set; } = false; + + /// if you want to add controllers with views, otherwise public bool AddControllersAsServices { get; set; } = false; + + /// if you want to add the Microsoft Identity UI, otherwise public bool AddMicrosoftIdentityUI { get; set; } = false; + + /// if you want to add JSON serializer options, otherwise public bool AddJsonOptions { get; set; } = false; + + /// if you want to add XML serializer formatters, otherwise public bool AddXmlSerializerFormatters { get; set; } = false; + + /// if you want to add XML data contract serializer formatters, otherwise public bool AddXmlDataContractSerializerFormatters { get; set; } = false; + + /// if you want to add the DGMJR MVC conventions, otherwise public bool AddMvcConventions { get; set; } = false; + + /// if you want to add controllers, otherwise public bool AddControllers { get; set; } = false; + + /// + public new bool AllowEmptyInputInBodyModelBinding + { + get => base.AllowEmptyInputInBodyModelBinding; + set => base.AllowEmptyInputInBodyModelBinding = value; + } + + /// + public new bool EnableActionInvokers + { + get => base.EnableActionInvokers; + set => base.EnableActionInvokers = value; + } + + /// + public new bool EnableEndpointRouting + { + get => base.EnableEndpointRouting; + set => base.EnableEndpointRouting = value; + } + + /// + public new bool RespectBrowserAcceptHeader + { + get => base.RespectBrowserAcceptHeader; + set => base.RespectBrowserAcceptHeader = value; + } + + /// + public new bool RequireHttpsPermanent + { + get => base.RequireHttpsPermanent; + set => base.RequireHttpsPermanent = value; + } + + /// + public new bool SuppressAsyncSuffixInActionNames + { + get => base.SuppressAsyncSuffixInActionNames; + set => base.SuppressAsyncSuffixInActionNames = value; + } + + /// + public new bool SuppressInputFormatterBuffering + { + get => base.SuppressInputFormatterBuffering; + set => base.SuppressInputFormatterBuffering = value; + } + + /// + public new bool SuppressOutputFormatterBuffering + { + get => base.SuppressOutputFormatterBuffering; + set => base.SuppressOutputFormatterBuffering = value; + } + + /// + public new bool ValidateComplexTypesIfChildValidationFails + { + get => base.ValidateComplexTypesIfChildValidationFails; + set => base.ValidateComplexTypesIfChildValidationFails = value; + } + + /// + public new bool SuppressImplicitRequiredAttributeForNonNullableReferenceTypes + { + get => base.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes; + set => base.SuppressImplicitRequiredAttributeForNonNullableReferenceTypes = value; + } + + /// + public new bool ReturnHttpNotAcceptable + { + get => base.ReturnHttpNotAcceptable; + set => base.ReturnHttpNotAcceptable = value; + } + + /// + public new IDictionary CacheProfiles + { + get => base.CacheProfiles; + set + { + base.CacheProfiles.Clear(); + ForEach(value.ToArray(), cp => base.CacheProfiles.Add(cp)); + } + } + + /// + public new IList Conventions + { + get => base.Conventions; + set + { + base.Conventions.Clear(); + ForEach(value.ToArray(), c => base.Conventions.Add(c)); + } + } } diff --git a/src/Razor/Models/PageModelOfT.cs b/src/Razor/Models/PageModelOfT.cs index 650baf82..f7eabe84 100644 --- a/src/Razor/Models/PageModelOfT.cs +++ b/src/Razor/Models/PageModelOfT.cs @@ -17,24 +17,24 @@ namespace Dgmjr.AspNetCore.Razor; public class PageModel(object? model = default) : PageModelBase { - public object? ViewModel { get; set; } = model; + public virtual object? ViewModel { get; set; } = model; - public string? Title + public virtual string? Title { get => ViewData[nameof(Title)]?.ToString(); set => ViewData[nameof(Title)] = value; } - public string? Description + public virtual string? Description { get => ViewData[nameof(Description)]?.ToString(); set => ViewData[nameof(Description)] = value; } - public string[]? Keywords + public virtual string[]? Keywords { get => ViewData[nameof(Keywords)] as string[]; set => ViewData[nameof(Keywords)] = value; } - public string? Author + public virtual string? Author { get => ViewData[nameof(Author)]?.ToString(); set => ViewData[nameof(Author)] = value; @@ -43,7 +43,7 @@ public string? Author public class PageModel(T? model) : PageModel(model) { - public new T? ViewModel + public new virtual T? ViewModel { get => (T?)base.ViewModel; set => base.ViewModel = value; diff --git a/src/Swagger/AddSwaggerGen.cs b/src/Swagger/AddSwaggerGen.cs index 59b66c8a..6e251eca 100644 --- a/src/Swagger/AddSwaggerGen.cs +++ b/src/Swagger/AddSwaggerGen.cs @@ -24,8 +24,8 @@ public static partial class SwaggerExtensions const string SwaggerUI = nameof(SwaggerUI); - public static IHostApplicationBuilder AddSwaggerGen( - this IHostApplicationBuilder builder, + public static WebApplicationBuilder AddSwaggerGen( + this WebApplicationBuilder builder, string configurationSectionKey = Swagger, Action? configure = default ) diff --git a/src/Swagger/Dgmjr.AspNetCore.Swagger.csproj b/src/Swagger/Dgmjr.AspNetCore.Swagger.csproj index 2414b90b..652f0d03 100644 --- a/src/Swagger/Dgmjr.AspNetCore.Swagger.csproj +++ b/src/Swagger/Dgmjr.AspNetCore.Swagger.csproj @@ -21,8 +21,8 @@ - - + + diff --git a/src/Swagger/Dgmjr.AspNetCore.Swagger.sln b/src/Swagger/Dgmjr.AspNetCore.Swagger.sln index dec190ea..a02074b3 100644 --- a/src/Swagger/Dgmjr.AspNetCore.Swagger.sln +++ b/src/Swagger/Dgmjr.AspNetCore.Swagger.sln @@ -8,11 +8,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ..\..\..\..\Packages\Versions.Local.props = ..\..\..\..\Packages\Versions.Local.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "..\Http\Mime\Dgmjr.Mime.csproj", "{AD32CC21-23B7-4198-8A07-239412C29348}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Mime", "..\Http\Mime\Dgmjr.Mime.csproj", "{70B3D056-4633-4C33-8075-79D7F8ABB14A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Payloads", "..\Payloads\Dgmjr.Payloads.csproj", "{DCF860FE-897B-438B-85B1-1231EB06DAEE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Payloads", "..\Payloads\Dgmjr.Payloads.csproj", "{6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Swagger", "Dgmjr.AspNetCore.Swagger.csproj", "{E41934B4-7402-4951-A008-644AC0761AF1}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.Swagger", "Dgmjr.AspNetCore.Swagger.csproj", "{F272F784-F56E-487A-9BFF-14AEECD9EAD8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -24,42 +24,42 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {AD32CC21-23B7-4198-8A07-239412C29348}.Local|Any CPU.ActiveCfg = Local|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Local|Any CPU.Build.0 = Local|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Testing|Any CPU.Build.0 = Testing|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Staging|Any CPU.Build.0 = Staging|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Production|Any CPU.ActiveCfg = Local|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Production|Any CPU.Build.0 = Local|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AD32CC21-23B7-4198-8A07-239412C29348}.Release|Any CPU.Build.0 = Release|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Local|Any CPU.ActiveCfg = Local|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Local|Any CPU.Build.0 = Local|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Testing|Any CPU.Build.0 = Testing|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Staging|Any CPU.Build.0 = Staging|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Production|Any CPU.ActiveCfg = Local|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Production|Any CPU.Build.0 = Local|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DCF860FE-897B-438B-85B1-1231EB06DAEE}.Release|Any CPU.Build.0 = Release|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Local|Any CPU.ActiveCfg = Local|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Local|Any CPU.Build.0 = Local|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Testing|Any CPU.Build.0 = Testing|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Staging|Any CPU.Build.0 = Staging|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Production|Any CPU.ActiveCfg = Local|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Production|Any CPU.Build.0 = Local|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E41934B4-7402-4951-A008-644AC0761AF1}.Release|Any CPU.Build.0 = Release|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Local|Any CPU.ActiveCfg = Local|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Local|Any CPU.Build.0 = Local|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Testing|Any CPU.Build.0 = Testing|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Staging|Any CPU.Build.0 = Staging|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Production|Any CPU.ActiveCfg = Local|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Production|Any CPU.Build.0 = Local|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70B3D056-4633-4C33-8075-79D7F8ABB14A}.Release|Any CPU.Build.0 = Release|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Local|Any CPU.ActiveCfg = Local|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Local|Any CPU.Build.0 = Local|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Testing|Any CPU.Build.0 = Testing|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Staging|Any CPU.Build.0 = Staging|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Production|Any CPU.ActiveCfg = Local|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Production|Any CPU.Build.0 = Local|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6AFA022E-28E4-4AC2-9981-1B293E6CA8E9}.Release|Any CPU.Build.0 = Release|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Local|Any CPU.ActiveCfg = Local|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Local|Any CPU.Build.0 = Local|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Testing|Any CPU.Build.0 = Testing|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Staging|Any CPU.Build.0 = Staging|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Production|Any CPU.ActiveCfg = Local|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Production|Any CPU.Build.0 = Local|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F272F784-F56E-487A-9BFF-14AEECD9EAD8}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Swagger/SwaggerAutoConfigurator.cs b/src/Swagger/SwaggerAutoConfigurator.cs index 6caddff6..477398b0 100644 --- a/src/Swagger/SwaggerAutoConfigurator.cs +++ b/src/Swagger/SwaggerAutoConfigurator.cs @@ -8,7 +8,7 @@ public class SwaggerAutoConfigurator { public ConfigurationOrder Order => ConfigurationOrder.AnyTime; - public void Configure(IHostApplicationBuilder builder) + public void Configure(WebApplicationBuilder builder) { builder.AddSwaggerGen(); } diff --git a/src/Swagger/SwaggerExtensions/AddExamplesExtension.cs b/src/Swagger/SwaggerExtensions/AddExamplesExtension.cs index 23287fec..50b6da80 100644 --- a/src/Swagger/SwaggerExtensions/AddExamplesExtension.cs +++ b/src/Swagger/SwaggerExtensions/AddExamplesExtension.cs @@ -17,8 +17,8 @@ namespace Microsoft.Extensions.DependencyInjection; internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder AddSwaggerExamples( - this IHostApplicationBuilder builder, + public static WebApplicationBuilder AddSwaggerExamples( + this WebApplicationBuilder builder, params Assembly[]? assemblies ) { diff --git a/src/Swagger/SwaggerExtensions/AddSwaggerMetadataExtension.cs b/src/Swagger/SwaggerExtensions/AddSwaggerMetadataExtension.cs index 4293111e..d24bbe56 100644 --- a/src/Swagger/SwaggerExtensions/AddSwaggerMetadataExtension.cs +++ b/src/Swagger/SwaggerExtensions/AddSwaggerMetadataExtension.cs @@ -31,8 +31,8 @@ namespace Microsoft.Extensions.DependencyInjection; internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder AddSwaggerMetadata( - this IHostApplicationBuilder builder, + public static WebApplicationBuilder AddSwaggerMetadata( + this WebApplicationBuilder builder, Type tThisAssemblyProject, string version = "v1", OpenApiInfo? openApiInfo = default @@ -55,8 +55,8 @@ public static IHostApplicationBuilder AddSwaggerMetadata( return builder; } - public static IHostApplicationBuilder AddApiKeyToSwaggerSecurity( - this IHostApplicationBuilder builder + public static WebApplicationBuilder AddApiKeyToSwaggerSecurity( + this WebApplicationBuilder builder ) { builder.Services.ConfigureSwaggerGen(c => @@ -77,8 +77,8 @@ this IHostApplicationBuilder builder return builder; } - public static IHostApplicationBuilder DescribeBasicApiAuthentication( - this IHostApplicationBuilder builder + public static WebApplicationBuilder DescribeBasicApiAuthentication( + this WebApplicationBuilder builder ) { builder.Services.ConfigureSwaggerGen(c => @@ -114,8 +114,8 @@ this IHostApplicationBuilder builder return builder; } - public static IHostApplicationBuilder AddSwaggerHeaderOperationFilter( - this IHostApplicationBuilder builder + public static WebApplicationBuilder AddSwaggerHeaderOperationFilter( + this WebApplicationBuilder builder ) { builder.Services.ConfigureSwaggerGen( @@ -129,8 +129,8 @@ this IHostApplicationBuilder builder return builder; } - public static IHostApplicationBuilder DescribeDataTypesToSwagger( - this IHostApplicationBuilder builder + public static WebApplicationBuilder DescribeDataTypesToSwagger( + this WebApplicationBuilder builder ) { builder.Services.Describe(); diff --git a/src/Swagger/SwaggerExtensions/AddXmlCommentsToSwaggerExtensions.cs b/src/Swagger/SwaggerExtensions/AddXmlCommentsToSwaggerExtensions.cs index 1af0e979..b0f934e3 100644 --- a/src/Swagger/SwaggerExtensions/AddXmlCommentsToSwaggerExtensions.cs +++ b/src/Swagger/SwaggerExtensions/AddXmlCommentsToSwaggerExtensions.cs @@ -33,7 +33,7 @@ public static bool IsParsable(string xmlDoc) return false; } - public static IHostApplicationBuilder AddXmlCommentsToSwagger(this IHostApplicationBuilder builder) + public static WebApplicationBuilder AddXmlCommentsToSwagger(this WebApplicationBuilder builder) { var binRoot = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var xmlDocs = Directory diff --git a/src/Swagger/SwaggerExtensions/DescribeEnumsAsStrings.cs b/src/Swagger/SwaggerExtensions/DescribeEnumsAsStrings.cs index cbbb9d1a..9119aa5e 100644 --- a/src/Swagger/SwaggerExtensions/DescribeEnumsAsStrings.cs +++ b/src/Swagger/SwaggerExtensions/DescribeEnumsAsStrings.cs @@ -1,8 +1,10 @@ namespace Microsoft.Extensions.DependencyInjection; +using Microsoft.AspNetCore.Builder; + internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder DescribeEnumsAsStrings(this IHostApplicationBuilder builder) + public static WebApplicationBuilder DescribeEnumsAsStrings(this WebApplicationBuilder builder) { builder.Services.ConfigureSwaggerGen(c => c.SchemaFilter()); return builder; diff --git a/src/Swagger/SwaggerExtensions/DescribeFileUploads.cs b/src/Swagger/SwaggerExtensions/DescribeFileUploads.cs index 80ed757d..f0493727 100644 --- a/src/Swagger/SwaggerExtensions/DescribeFileUploads.cs +++ b/src/Swagger/SwaggerExtensions/DescribeFileUploads.cs @@ -22,9 +22,7 @@ namespace Microsoft.Extensions.DependencyInjection; internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder DescribeFileUploads( - this IHostApplicationBuilder builder - ) + public static WebApplicationBuilder DescribeFileUploads(this WebApplicationBuilder builder) { builder.Services.ConfigureSwaggerGen( options => options.OperationFilter() diff --git a/src/Swagger/SwaggerExtensions/DescribeSchemasViaAttributes.cs b/src/Swagger/SwaggerExtensions/DescribeSchemasViaAttributes.cs index c703bffe..4d0bec1a 100644 --- a/src/Swagger/SwaggerExtensions/DescribeSchemasViaAttributes.cs +++ b/src/Swagger/SwaggerExtensions/DescribeSchemasViaAttributes.cs @@ -16,8 +16,8 @@ namespace Microsoft.Extensions.DependencyInjection; internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder DescribeSchemasViaAttributes( - this IHostApplicationBuilder builder + public static WebApplicationBuilder DescribeSchemasViaAttributes( + this WebApplicationBuilder builder ) { builder.Services.DescribeSchemasViaAttributes(); diff --git a/src/Swagger/SwaggerExtensions/DescribeTypesForAllOutputFormatters.cs b/src/Swagger/SwaggerExtensions/DescribeTypesForAllOutputFormatters.cs index 26a8ba04..36510036 100644 --- a/src/Swagger/SwaggerExtensions/DescribeTypesForAllOutputFormatters.cs +++ b/src/Swagger/SwaggerExtensions/DescribeTypesForAllOutputFormatters.cs @@ -28,8 +28,8 @@ this IServiceCollection services return services; } - public static IHostApplicationBuilder DescribeTypesForAllOutputFormatters( - this IHostApplicationBuilder builder + public static WebApplicationBuilder DescribeTypesForAllOutputFormatters( + this WebApplicationBuilder builder ) { builder.Services.ConfigureSwaggerGen( diff --git a/src/Swagger/SwaggerExtensions/SwaggerConflictingActionsResolver.cs b/src/Swagger/SwaggerExtensions/SwaggerConflictingActionsResolver.cs index 105a20ff..b430c738 100644 --- a/src/Swagger/SwaggerExtensions/SwaggerConflictingActionsResolver.cs +++ b/src/Swagger/SwaggerExtensions/SwaggerConflictingActionsResolver.cs @@ -16,8 +16,8 @@ namespace Microsoft.Extensions.DependencyInjection; internal static partial class InternalSwaggerExtensions { - public static IHostApplicationBuilder AddSwaggerConflictingActionsResolver( - this IHostApplicationBuilder builder + public static WebApplicationBuilder AddSwaggerConflictingActionsResolver( + this WebApplicationBuilder builder ) { builder.Services.ConfigureSwaggerGen( diff --git a/src/TagHelpers/Bootstrap/Code/TypeName.cs b/src/TagHelpers/Bootstrap/Code/TypeName.cs new file mode 100644 index 00000000..eddfb995 --- /dev/null +++ b/src/TagHelpers/Bootstrap/Code/TypeName.cs @@ -0,0 +1,125 @@ +/* + * TypeName.cs + * + * Created: 2024-22-27T05:22:04-05:00 + * Modified: 2024-22-27T05:22:04-05:00 + * + * Author: David G. Moore, Jr. + * + * Copyright © 2024 David G. Moore, Jr., All Rights Reserved + * License: MIT (https://opensource.org/licenses/MIT) + */ + +using System.Threading.Tasks; + +namespace Dgmjr.AspNetCore.TagHelpers.Bootstrap.Code; + +[HtmlTargetElement("code", Attributes = "class-name")] +[HtmlTargetElement("class-name", ParentTag = "code")] +[HtmlTargetElement("class", ParentTag = "code")] +public class ClassName : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("type"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "const")] +[HtmlTargetElement("const", ParentTag = "code")] +public class Constant : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("constant"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "keyword")] +[HtmlTargetElement("keyword", ParentTag = "code")] +public class Keyword : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("keyword"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "var")] +[HtmlTargetElement("var", ParentTag = "code")] +public class Variable : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("variable"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "number")] +[HtmlTargetElement("number", ParentTag = "code")] +[HtmlTargetElement("numeric", ParentTag = "code")] +[HtmlTargetElement("numeric-literal", ParentTag = "code")] +public class NumberLiteral : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("number"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "primitive")] +[HtmlTargetElement("primitive", ParentTag = "code")] +public class Primitive : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("primitive"); + return base.ProcessAsync(context, output); + /* this is a comment */ + } +} + +[HtmlTargetElement("code", Attributes = "string")] +[HtmlTargetElement("string", ParentTag = "code")] +[HtmlTargetElement("string-literal", ParentTag = "code")] +public class StringLiteral : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("string"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "method")] +[HtmlTargetElement("code", Attributes = "function")] +[HtmlTargetElement("code", Attributes = "property")] +[HtmlTargetElement("code", Attributes = "prop")] +[HtmlTargetElement("method", ParentTag = "code")] +[HtmlTargetElement("function", ParentTag = "code")] +[HtmlTargetElement("property", ParentTag = "code")] +[HtmlTargetElement("prop", ParentTag = "code")] +public class MethodOrProperty : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("method"); + return base.ProcessAsync(context, output); + } +} + +[HtmlTargetElement("code", Attributes = "namespace")] +[HtmlTargetElement("namespace", ParentTag = "code")] +public class Namespace : TagHelper +{ + public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output) + { + output.AddCssClass("namespace"); + return base.ProcessAsync(context, output); + } +} diff --git a/src/TagHelpers/Constants/TagHelperConstants.AttributeNames.cs b/src/TagHelpers/Constants/TagHelperConstants.AttributeNames.cs new file mode 100644 index 00000000..7a6642c9 --- /dev/null +++ b/src/TagHelpers/Constants/TagHelperConstants.AttributeNames.cs @@ -0,0 +1,97 @@ +namespace Dgmjr.AspNetCore.TagHelpers; + +public static partial class TagHelperConstants +{ + public static class AttributeNames + { + public const string Action = TagPrefixes.Asp + "action"; + public const string Alt = "alt"; + public const string Area = TagPrefixes.Asp + "area"; + public const string AriaControls = "aria-controls"; + public const string AriaExpanded = "aria-expanded"; + public const string AriaLabel = "aria-label"; + public const string AspIf = TagPrefixes.Asp + "if"; + public const string Class = "class"; + public const string BsLabelPosition = TagPrefixes.Bootstrap + "label-position"; + public const string BorderColor = TagPrefixes.Bootstrap + "border-color"; + public const string BackgroundColor = TagPrefixes.Bootstrap + "bg-color"; + public const string Color = TagPrefixes.Bootstrap + "color"; + public const string Controller = TagPrefixes.Asp + "controller"; + public const string DataDismiss = TagPrefixes.Data + "dismiss"; + public const string DataParent = TagPrefixes.Data + "parent"; + public const string DataRide = TagPrefixes.Data + "ride"; + public const string DataSlide = TagPrefixes.Data + "slide"; + public const string DataSlideTo = TagPrefixes.Data + "slide-to"; + public const string DataBsTarget = TagPrefixes.Data + "bs-target"; + public const string DataTarget = TagPrefixes.Data + "target"; + public const string DataTargetCarousel = TagPrefixes.Data + "target-carousel"; + public const string DataTargetCollapse = TagPrefixes.Data + "target-collapse"; + public const string DataTargetDismiss = TagPrefixes.Data + "target-dismiss"; + public const string DataTargetModal = TagPrefixes.Data + "target-modal"; + public const string DataTargetModalBackdrop = TagPrefixes.Data + "target-modal-backdrop"; + public const string DataTargetModalBackdropDismiss = + TagPrefixes.Data + "target-modal-backdrop-dismiss"; + public const string DataTargetModalBackdropStatic = + TagPrefixes.Data + "target-modal-backdrop-static"; + public const string DataTargetModalBackdropToggle = + TagPrefixes.Data + "target-modal-backdrop-toggle"; + public const string DataTargetModalDismiss = TagPrefixes.Data + "target-modal-dismiss"; + public const string DataTargetModalKeyboard = TagPrefixes.Data + "target-modal-keyboard"; + public const string DataTargetModalRemote = TagPrefixes.Data + "target-modal-remote"; + public const string DataTargetModalScroll = TagPrefixes.Data + "target-modal-scroll"; + public const string DataTargetModalShow = TagPrefixes.Data + "target-modal-show"; + public const string DataTargetModalStatic = TagPrefixes.Data + "target-modal-static"; + public const string DataTargetModalToggle = TagPrefixes.Data + "target-modal-toggle"; + public const string DataTargetParent = TagPrefixes.Data + "target-parent"; + public const string DataTargetPopover = TagPrefixes.Data + "target-popover"; + public const string DataTargetRide = TagPrefixes.Data + "target-ride"; + public const string DataTargetSlide = TagPrefixes.Data + "target-slide"; + public const string DataTargetSlideTo = TagPrefixes.Data + "target-slide-to"; + public const string DataTargetTab = TagPrefixes.Data + "target-tab"; + public const string DataTargetToggle = TagPrefixes.Data + "target-toggle"; + public const string DataTargetTooltip = TagPrefixes.Data + "target-tooltip"; + public const string DataBsToggle = TagPrefixes.Data + "bs-toggle"; + public const string DataToggle = TagPrefixes.Data + "toggle"; + public const string Disabled = "disabled"; + public const string For = "for"; + public const string Header = "header"; + public const string HeaderBorderColor = "header-border-color"; + public const string HeaderColor = "header-color"; + public const string HeadingType = "heading-type"; + public const string Height = "height"; + public const string Href = "href"; + public const string Id = "id"; + public const string IsExpanded = "expanded"; + public const string Label = "label"; + public const string MarginBottom = "margin-bottom"; + public const string Name = "name"; + public const string Placeholder = "placeholder"; + public const string TextBefore = "text-before"; + public const string TextAfter = "text-after"; + public const string Position = "position"; + public const string Readonly = "readonly"; + public const string Required = "required"; + public const string Role = "role"; + public const string Rows = "rows"; + public const string Size = "size"; + public const string Src = "src"; + public const string SrcSet = "srcset"; + public const string SrcSetMedia = "media"; + public const string SrcSetSizes = "sizes"; + public const string SrcSetType = "type"; + public const string SrcSetTypeApplication = "application"; + public const string SrcSetTypeAudio = "audio"; + public const string SrcSetTypeFont = "font"; + public const string SrcSetTypeImage = "image"; + public const string SrcSetTypeJson = "json"; + public const string SrcSetTypeText = "text"; + public const string SrcSetTypeVideo = "video"; + public const string SrcSetTypeXhtml = "xhtml"; + public const string SrcSetTypeXml = "xml"; + public const string Target = "target"; + public const string Title = "title"; + public const string Type = "type"; + public const string Value = "value"; + public const string Variant = "variant"; + } +} diff --git a/src/TagHelpers/TagHelperConstants.cs b/src/TagHelpers/Constants/TagHelperConstants.CssClasses.cs similarity index 70% rename from src/TagHelpers/TagHelperConstants.cs rename to src/TagHelpers/Constants/TagHelperConstants.CssClasses.cs index 3e166e18..e617f27d 100644 --- a/src/TagHelpers/TagHelperConstants.cs +++ b/src/TagHelpers/Constants/TagHelperConstants.CssClasses.cs @@ -1,146 +1,7 @@ namespace Dgmjr.AspNetCore.TagHelpers; -public static class TagHelperConstants +public static partial class TagHelperConstants { - public static class TagNames - { - public const string Accordion = "accordion"; - public const string AccordionItem = "accordion-item"; - public const string Alert = "alert"; - public const string Anchor = "a"; - public const string Any = "*"; - public const string Btn = "btn"; - public const string Button = "button"; - public const string Contact = "contact"; - public const string Container = "container"; - public const string ClientSideValidationScript = "client-side-validation-script"; - public const string Div = "div"; - public const string Divider = "hr"; - public const string DropdownItem = "dropdown-item"; - public const string Email = "email"; - public const string Expanded = "expanded"; - public const string Footer = "footer"; - public const string Form = "form"; - public const string Img = "img"; - public const string Input = "input"; - public const string Li = "li"; - public const string Nav = "nav"; - public const string Navbar = "navbar"; - public const string NavbarLink = "navbar-link"; - public const string NavbarNav = "navbar-nav"; - public const string NavbarNavRight = "navbar-nav-right"; - public const string NavbarText = "navbar-text"; - public const string NavDropdown = "nav-dropdown"; - public const string NavDropdownItem = "nav-dropdown-item"; - public const string NavDropdownLink = "nav-dropdown-link"; - public const string NavForm = "nav-form"; - public const string NavItem = "nav-item"; - public const string NavLink = "nav-link"; - public const string NavText = "nav-text"; - public const string PageHeader = "page-header"; - public const string Panel = "panel"; - public const string PanelBody = "panel-body"; - public const string PanelFooter = "panel-footer"; - public const string PanelHeading = "panel-heading"; - public const string PanelTitle = "panel-title"; - public const string Paragraph = "p"; - public const string Select = "select"; - public const string Span = "span"; - public const string Table = "table"; - public const string TextArea = "textarea"; - public const string Ul = "ul"; - } - - public static class AttributeNames - { - public const string Action = "asp-action"; - public const string Alt = "alt"; - public const string Area = "asp-area"; - public const string AriaControls = "aria-controls"; - public const string AriaExpanded = "aria-expanded"; - public const string AriaLabel = "aria-label"; - public const string AspIf = "asp-if"; - public const string Class = "class"; - public const string BsLabelPosition = "bs-label-position"; - public const string BorderColor = "bs-border-color"; - public const string BackgroundColor = "bs-bg-color"; - public const string Color = "bs-color"; - public const string Controller = "asp-controller"; - public const string DataDismiss = "data-dismiss"; - public const string DataParent = "data-parent"; - public const string DataRide = "data-ride"; - public const string DataSlide = "data-slide"; - public const string DataSlideTo = "data-slide-to"; - public const string DataBsTarget = "data-bs-target"; - public const string DataTarget = "data-target"; - public const string DataTargetCarousel = "data-target-carousel"; - public const string DataTargetCollapse = "data-target-collapse"; - public const string DataTargetDismiss = "data-target-dismiss"; - public const string DataTargetModal = "data-target-modal"; - public const string DataTargetModalBackdrop = "data-target-modal-backdrop"; - public const string DataTargetModalBackdropDismiss = "data-target-modal-backdrop-dismiss"; - public const string DataTargetModalBackdropStatic = "data-target-modal-backdrop-static"; - public const string DataTargetModalBackdropToggle = "data-target-modal-backdrop-toggle"; - public const string DataTargetModalDismiss = "data-target-modal-dismiss"; - public const string DataTargetModalKeyboard = "data-target-modal-keyboard"; - public const string DataTargetModalRemote = "data-target-modal-remote"; - public const string DataTargetModalScroll = "data-target-modal-scroll"; - public const string DataTargetModalShow = "data-target-modal-show"; - public const string DataTargetModalStatic = "data-target-modal-static"; - public const string DataTargetModalToggle = "data-target-modal-toggle"; - public const string DataTargetParent = "data-target-parent"; - public const string DataTargetPopover = "data-target-popover"; - public const string DataTargetRide = "data-target-ride"; - public const string DataTargetSlide = "data-target-slide"; - public const string DataTargetSlideTo = "data-target-slide-to"; - public const string DataTargetTab = "data-target-tab"; - public const string DataTargetToggle = "data-target-toggle"; - public const string DataTargetTooltip = "data-target-tooltip"; - public const string DataBsToggle = "data-bs-toggle"; - public const string DataToggle = "data-toggle"; - public const string Disabled = "disabled"; - public const string For = "for"; - public const string Header = "header"; - public const string HeaderBorderColor = "header-border-color"; - public const string HeaderColor = "header-color"; - public const string HeadingType = "heading-type"; - public const string Height = "height"; - public const string Href = "href"; - public const string Id = "id"; - public const string IsExpanded = "expanded"; - public const string Label = "label"; - public const string MarginBottom = "margin-bottom"; - public const string Name = "name"; - public const string Placeholder = "placeholder"; - public const string TextBefore = "text-before"; - public const string TextAfter = "text-after"; - public const string Position = "position"; - public const string Readonly = "readonly"; - public const string Required = "required"; - public const string Role = "role"; - public const string Rows = "rows"; - public const string Size = "size"; - public const string Src = "src"; - public const string SrcSet = "srcset"; - public const string SrcSetMedia = "media"; - public const string SrcSetSizes = "sizes"; - public const string SrcSetType = "type"; - public const string SrcSetTypeApplication = "application"; - public const string SrcSetTypeAudio = "audio"; - public const string SrcSetTypeFont = "font"; - public const string SrcSetTypeImage = "image"; - public const string SrcSetTypeJson = "json"; - public const string SrcSetTypeText = "text"; - public const string SrcSetTypeVideo = "video"; - public const string SrcSetTypeXhtml = "xhtml"; - public const string SrcSetTypeXml = "xml"; - public const string Target = "target"; - public const string Title = "title"; - public const string Type = "type"; - public const string Value = "value"; - public const string Variant = "variant"; - } - public static class CssClasses { public const string Accordion = "accordion"; diff --git a/src/TagHelpers/Constants/TagHelperConstants.TagNames.cs b/src/TagHelpers/Constants/TagHelperConstants.TagNames.cs new file mode 100644 index 00000000..fbd725f2 --- /dev/null +++ b/src/TagHelpers/Constants/TagHelperConstants.TagNames.cs @@ -0,0 +1,53 @@ +namespace Dgmjr.AspNetCore.TagHelpers; + +public static partial class TagHelperConstants +{ + public static class TagNames + { + public const string Accordion = "accordion"; + public const string AccordionItem = "accordion-item"; + public const string Alert = "alert"; + public const string Anchor = "a"; + public const string Any = "*"; + public const string Btn = "btn"; + public const string Button = "button"; + public const string Contact = "contact"; + public const string Container = "container"; + public const string ClientSideValidationScript = "client-side-validation-script"; + public const string Div = "div"; + public const string Divider = "hr"; + public const string DropdownItem = "dropdown-item"; + public const string Email = "email"; + public const string Expanded = "expanded"; + public const string Footer = "footer"; + public const string Form = "form"; + public const string Img = "img"; + public const string Input = "input"; + public const string Li = "li"; + public const string Nav = "nav"; + public const string Navbar = "navbar"; + public const string NavbarLink = "navbar-link"; + public const string NavbarNav = "navbar-nav"; + public const string NavbarNavRight = "navbar-nav-right"; + public const string NavbarText = "navbar-text"; + public const string NavDropdown = "nav-dropdown"; + public const string NavDropdownItem = "nav-dropdown-item"; + public const string NavDropdownLink = "nav-dropdown-link"; + public const string NavForm = "nav-form"; + public const string NavItem = "nav-item"; + public const string NavLink = "nav-link"; + public const string NavText = "nav-text"; + public const string PageHeader = "page-header"; + public const string Panel = "panel"; + public const string PanelBody = "panel-body"; + public const string PanelFooter = "panel-footer"; + public const string PanelHeading = "panel-heading"; + public const string PanelTitle = "panel-title"; + public const string Paragraph = "p"; + public const string Select = "select"; + public const string Span = "span"; + public const string Table = "table"; + public const string TextArea = "textarea"; + public const string Ul = "ul"; + } +} diff --git a/src/TagHelpers/Constants/TagHelperConstants.TagPrefixes.cs b/src/TagHelpers/Constants/TagHelperConstants.TagPrefixes.cs new file mode 100644 index 00000000..421a0e4a --- /dev/null +++ b/src/TagHelpers/Constants/TagHelperConstants.TagPrefixes.cs @@ -0,0 +1,12 @@ +namespace Dgmjr.AspNetCore.TagHelpers; + +public static partial class TagHelperConstants +{ + public static class TagPrefixes + { + public const string Aria = "aria-"; + public const string Asp = "asp-"; + public const string Bootstrap = "bs-"; + public const string Data = "data-"; + } +} diff --git a/src/TagHelpers/Constants/TagHelperConstants.cs b/src/TagHelpers/Constants/TagHelperConstants.cs new file mode 100644 index 00000000..03a4fd05 --- /dev/null +++ b/src/TagHelpers/Constants/TagHelperConstants.cs @@ -0,0 +1,3 @@ +namespace Dgmjr.AspNetCore.TagHelpers; + +public static partial class TagHelperConstants { } diff --git a/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.csproj b/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.csproj index e9fc6a75..519bacfc 100644 --- a/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.csproj +++ b/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.csproj @@ -63,6 +63,7 @@ + diff --git a/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.sln b/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.sln index 98527124..6c0ee817 100644 --- a/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.sln +++ b/src/TagHelpers/Dgmjr.AspNetCore.TagHelpers.sln @@ -10,7 +10,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.Abstractions", "..\..\..\Types\Abstractions\Dgmjr.Abstractions.csproj", "{A2F9676F-D2B3-436D-99A7-68FF47AC8741}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.TagHelpers", "Dgmjr.AspNetCore.TagHelpers.csproj", "{C5A6C7E0-B36A-472D-865A-BD32170F17CE}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Dgmjr.AspNetCore.TagHelpers", "Dgmjr.AspNetCore.TagHelpers.csproj", "{E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -34,18 +34,18 @@ Global {A2F9676F-D2B3-436D-99A7-68FF47AC8741}.Production|Any CPU.Build.0 = Local|Any CPU {A2F9676F-D2B3-436D-99A7-68FF47AC8741}.Release|Any CPU.ActiveCfg = Release|Any CPU {A2F9676F-D2B3-436D-99A7-68FF47AC8741}.Release|Any CPU.Build.0 = Release|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Local|Any CPU.ActiveCfg = Local|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Local|Any CPU.Build.0 = Local|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Testing|Any CPU.ActiveCfg = Testing|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Testing|Any CPU.Build.0 = Testing|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Staging|Any CPU.ActiveCfg = Staging|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Staging|Any CPU.Build.0 = Staging|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Production|Any CPU.ActiveCfg = Local|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Production|Any CPU.Build.0 = Local|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C5A6C7E0-B36A-472D-865A-BD32170F17CE}.Release|Any CPU.Build.0 = Release|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Local|Any CPU.ActiveCfg = Local|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Local|Any CPU.Build.0 = Local|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Testing|Any CPU.ActiveCfg = Testing|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Testing|Any CPU.Build.0 = Testing|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Staging|Any CPU.ActiveCfg = Staging|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Staging|Any CPU.Build.0 = Staging|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Production|Any CPU.ActiveCfg = Local|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Production|Any CPU.Build.0 = Local|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6715DDF-3BD8-4D0E-BFB9-5137D37B750C}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/TagHelpers/Resources/HighlightCode.js b/src/TagHelpers/Resources/HighlightCode.js new file mode 100644 index 00000000..e69de29b diff --git a/src/TagHelpers/Resources/code.css b/src/TagHelpers/Resources/code.css new file mode 100644 index 00000000..a3fb39bb --- /dev/null +++ b/src/TagHelpers/Resources/code.css @@ -0,0 +1,37 @@ +.keyword { + color: light-dark(#0077aa, #3b5f7c); + font-weight: bold; +} + +.primitive { + color: light-dark(#0077aa, #3b5f7c); +} + +.method { + color: light-dark(rgb(50, 40, 20), rgb(77, 77, 60)); +} + +.type { + color: light-dark(#0077aa, #4fc7af); +} + +.constant { + color: light-dark(#0077aa, #579cd6); +} + +.comment { + color: light-dark(#999988, #557846); + font-style: italic; +} + +.string { + color: light-dark(#22aa22, #936b5a); +} + +.number { + color: light-dark(#aa2222, #880000); +} + +code { + color: light-dark(#000000, #ffffff); +}