Configure project for NuGet packaging and implement WithData for chainable ViewData updates

This commit is contained in:
Developer 02
2024-04-17 16:55:53 +02:00
parent 82da3586a5
commit 217f4049db
196 changed files with 3070 additions and 90 deletions

View File

@@ -0,0 +1,26 @@
using Microsoft.AspNetCore.Mvc;
namespace DigitalData.Core.API
{
/// <summary>
/// Provides extension methods for controllers in ASP.NET Core applications.
/// This class is designed to enhance the functionality of <see cref="Controller"/>, <see cref="ControllerBase"/>,
/// and their related results such as <see cref="ViewResult"/>.
/// </summary>
public static class ControllerExtensions
{
/// <summary>
/// Adds or updates a value in the ViewData dictionary of a ViewResult. This method supports fluent chaining,
/// enabling cleaner and more readable modifications to ViewData.
/// </summary>
/// <param name="viewResult">The ViewResult to which ViewData will be added or updated.</param>
/// <param name="index">The key in the ViewData dictionary where the value will be stored.</param>
/// <param name="value">The value to be stored in the ViewData dictionary.</param>
/// <returns>The same ViewResult object with updated ViewData, allowing for additional chained operations.</returns>
public static ViewResult WithData(this ViewResult viewResult, string index, object value)
{
viewResult.ViewData[index] = value;
return viewResult;
}
}
}

View File

@@ -8,8 +8,9 @@
".NETCoreApp,Version=v7.0": {
"DigitalData.Core.API/1.0.0": {
"dependencies": {
"DigitalData.Core.Contracts": "1.0.0",
"Microsoft.Extensions.Logging": "7.0.0"
"Microsoft.Extensions.Logging": "7.0.0",
"WebCore.Contracts": "1.0.1",
"DigitalData.Core.Contracts": "1.0.1.0"
},
"runtime": {
"DigitalData.Core.API.dll": {}
@@ -283,7 +284,7 @@
}
}
},
"DigitalData.Core.Contracts/1.0.0": {
"WebCore.Contracts/1.0.1": {
"dependencies": {
"Microsoft.Extensions.Caching.Memory": "7.0.0",
"Microsoft.Extensions.Configuration.Binder": "7.0.4",
@@ -294,6 +295,14 @@
"runtime": {
"DigitalData.Core.Contracts.dll": {}
}
},
"DigitalData.Core.Contracts/1.0.1.0": {
"runtime": {
"DigitalData.Core.Contracts.dll": {
"assemblyVersion": "1.0.1.0",
"fileVersion": "1.0.1.0"
}
}
}
}
},
@@ -478,10 +487,15 @@
"path": "system.windows.extensions/7.0.0",
"hashPath": "system.windows.extensions.7.0.0.nupkg.sha512"
},
"DigitalData.Core.Contracts/1.0.0": {
"WebCore.Contracts/1.0.1": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"DigitalData.Core.Contracts/1.0.1.0": {
"type": "reference",
"serviceable": false,
"sha512": ""
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -67,6 +67,7 @@ E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.API\obj\Debug\net7.0
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.API\obj\Debug\net7.0\refint\DigitalData.Core.API.dll
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.API\obj\Debug\net7.0\DigitalData.Core.API.pdb
E:\TekH\Visual Studio\DDWeb\WebCoreModules\DigitalData.Core.API\obj\Debug\net7.0\ref\DigitalData.Core.API.dll
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\icon.png
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\DigitalData.Core.API.deps.json
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\DigitalData.Core.API.dll
E:\TekH\Visual Studio\WebCoreModules\DigitalData.Core.API\bin\Debug\net7.0\DigitalData.Core.API.pdb

View File

@@ -33,6 +33,7 @@
"D:\\ProgramFiles\\DevExpress 19.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 21.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 22.1\\Components\\System\\Components\\Packages": {},
"http://localhost:5000/v3/index.json": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@@ -84,10 +85,10 @@
}
},
"E:\\TekH\\Visual Studio\\WebCoreModules\\DigitalData.Core.Contracts\\DigitalData.Core.Contracts.csproj": {
"version": "1.0.0",
"version": "1.0.1",
"restore": {
"projectUniqueName": "E:\\TekH\\Visual Studio\\WebCoreModules\\DigitalData.Core.Contracts\\DigitalData.Core.Contracts.csproj",
"projectName": "DigitalData.Core.Contracts",
"projectName": "WebCore.Contracts",
"projectPath": "E:\\TekH\\Visual Studio\\WebCoreModules\\DigitalData.Core.Contracts\\DigitalData.Core.Contracts.csproj",
"packagesPath": "C:\\Users\\tekh\\.nuget\\packages\\",
"outputPath": "E:\\TekH\\Visual Studio\\WebCoreModules\\DigitalData.Core.Contracts\\obj\\",
@@ -112,6 +113,7 @@
"D:\\ProgramFiles\\DevExpress 19.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 21.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 22.1\\Components\\System\\Components\\Packages": {},
"http://localhost:5000/v3/index.json": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {

View File

@@ -508,7 +508,7 @@
}
}
},
"DigitalData.Core.Contracts/1.0.0": {
"WebCore.Contracts/1.0.1": {
"type": "project",
"framework": ".NETCoreApp,Version=v7.0",
"dependencies": {
@@ -519,10 +519,10 @@
"System.IdentityModel.Tokens.Jwt": "7.5.1"
},
"compile": {
"bin/placeholder/DigitalData.Core.Contracts.dll": {}
"bin/placeholder/WebCore.Contracts.dll": {}
},
"runtime": {
"bin/placeholder/DigitalData.Core.Contracts.dll": {}
"bin/placeholder/WebCore.Contracts.dll": {}
}
}
}
@@ -1271,7 +1271,7 @@
"useSharedDesignerContext.txt"
]
},
"DigitalData.Core.Contracts/1.0.0": {
"WebCore.Contracts/1.0.1": {
"type": "project",
"path": "../DigitalData.Core.Contracts/DigitalData.Core.Contracts.csproj",
"msbuildProject": "../DigitalData.Core.Contracts/DigitalData.Core.Contracts.csproj"
@@ -1279,8 +1279,8 @@
},
"projectFileDependencyGroups": {
"net7.0": [
"DigitalData.Core.Contracts >= 1.0.0",
"Microsoft.Extensions.Logging >= 7.0.0"
"Microsoft.Extensions.Logging >= 7.0.0",
"WebCore.Contracts >= 1.0.1"
]
},
"packageFolders": {
@@ -1318,6 +1318,7 @@
"D:\\ProgramFiles\\DevExpress 19.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 21.2\\Components\\System\\Components\\Packages": {},
"D:\\ProgramFiles\\DevExpress 22.1\\Components\\System\\Components\\Packages": {},
"http://localhost:5000/v3/index.json": {},
"https://api.nuget.org/v3/index.json": {}
},
"frameworks": {
@@ -1367,5 +1368,13 @@
"runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\7.0.202\\RuntimeIdentifierGraph.json"
}
}
}
},
"logs": [
{
"code": "NU1803",
"level": "Warning",
"warningLevel": 1,
"message": "You are running the 'restore' operation with an 'HTTP' source, 'http://localhost:5000/v3/index.json'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source."
}
]
}

View File

@@ -1,6 +1,6 @@
{
"version": 2,
"dgSpecHash": "yXABE/TQcN7K37vYTbS+TsUQ8oyW2LVpuOff3GiYG62BFiV4GBbd1KQ0kR+mK3JdiQvv1VA+ceDHrEulQc4xtw==",
"dgSpecHash": "tndWnU7t4tnqatxEBQMDJJVorx0bTTuEtnpzgesjt88QGOK4Gg5UrovBlugBpr+iLZqUsOHwvR3sK+JGS4la/w==",
"success": true,
"projectFilePath": "E:\\TekH\\Visual Studio\\WebCoreModules\\DigitalData.Core.API\\DigitalData.Core.API.csproj",
"expectedPackageFiles": [
@@ -30,5 +30,12 @@
"C:\\Users\\tekh\\.nuget\\packages\\system.security.permissions\\7.0.0\\system.security.permissions.7.0.0.nupkg.sha512",
"C:\\Users\\tekh\\.nuget\\packages\\system.windows.extensions\\7.0.0\\system.windows.extensions.7.0.0.nupkg.sha512"
],
"logs": []
"logs": [
{
"code": "NU1803",
"level": "Warning",
"warningLevel": 1,
"message": "You are running the 'restore' operation with an 'HTTP' source, 'http://localhost:5000/v3/index.json'. Non-HTTPS access will be removed in a future version. Consider migrating to an 'HTTPS' source."
}
]
}