From a63aa502f9e6d9764b13fba0bea901fbfde60db1 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 29 Apr 2022 09:51:37 +0200 Subject: [PATCH 1/9] Completo editing company selector --- .../WebUserControls/cmp_CompanySelector.ascx | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/MP-ADM/WebUserControls/cmp_CompanySelector.ascx b/MP-ADM/WebUserControls/cmp_CompanySelector.ascx index 5a41986a..f5014833 100644 --- a/MP-ADM/WebUserControls/cmp_CompanySelector.ascx +++ b/MP-ADM/WebUserControls/cmp_CompanySelector.ascx @@ -3,18 +3,22 @@
-
+
-

<%: traduci("CurrentCompany") %>

- - +
+
+

<%: traduci("CurrentCompany") %>

+ + +
+
+ +
+
+ +
+
-
- -
-
- -
From a264d6cbc03c88f6397361e98ddad9422388ea6e Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 29 Apr 2022 09:52:50 +0200 Subject: [PATCH 2/9] Nuget update NLog --- MP-ADM/MP-ADM.csproj | 2 +- MP-ADM/packages.config | 2 +- MP-IO/MP-IO.csproj | 6 +- MP-IO/NLog.xsd | 260 +++++++++++++++++++++++++--------------- MP-IO/packages.config | 6 +- MP-MAG/MP-MAG.csproj | 2 +- MP-MAG/packages.config | 2 +- MP-Site/MP-Site.csproj | 2 +- MP-Site/packages.config | 2 +- MP-TAB/MP-TAB.csproj | 2 +- MP-TAB/NLog.xsd | 260 +++++++++++++++++++++++++--------------- MP-TAB/packages.config | 6 +- MagData/MagData.csproj | 2 +- MagData/packages.config | 2 +- MapoDb/MapoDb.csproj | 2 +- MapoDb/packages.config | 2 +- 16 files changed, 352 insertions(+), 208 deletions(-) diff --git a/MP-ADM/MP-ADM.csproj b/MP-ADM/MP-ADM.csproj index 13034c09..b51bf213 100644 --- a/MP-ADM/MP-ADM.csproj +++ b/MP-ADM/MP-ADM.csproj @@ -100,7 +100,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll diff --git a/MP-ADM/packages.config b/MP-ADM/packages.config index c0bb3ec9..9c1dafe1 100644 --- a/MP-ADM/packages.config +++ b/MP-ADM/packages.config @@ -35,7 +35,7 @@ - + diff --git a/MP-IO/MP-IO.csproj b/MP-IO/MP-IO.csproj index 4673c173..d9ae70b8 100644 --- a/MP-IO/MP-IO.csproj +++ b/MP-IO/MP-IO.csproj @@ -96,7 +96,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll @@ -362,11 +362,11 @@ + + PreserveNewest - - Designer diff --git a/MP-IO/NLog.xsd b/MP-IO/NLog.xsd index eefeec81..d1674723 100644 --- a/MP-IO/NLog.xsd +++ b/MP-IO/NLog.xsd @@ -457,19 +457,21 @@ - + + + - + - + @@ -552,16 +554,21 @@ NDLC item separator. + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + Indicates whether to include source info (file name and line number) in the information sent over the network. - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - Indicates whether to include NLog-specific extensions to log4j schema. @@ -587,6 +594,11 @@ Indicates whether to include dictionary contents. + + + Option to include all properties from the log events + + Indicates whether to include call site (class and method name) in the information sent over the network. @@ -602,9 +614,9 @@ AppInfo field. By default it's the friendly name of the current AppDomain. - + - NDC item separator. + Renderer for log4j:event logger-xml-attribute (Default ${logger}) @@ -2240,19 +2252,21 @@ - + + + - + - + @@ -2335,16 +2349,21 @@ NDLC item separator. + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + Indicates whether to include source info (file name and line number) in the information sent over the network. - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - Indicates whether to include NLog-specific extensions to log4j schema. @@ -2370,6 +2389,11 @@ Indicates whether to include dictionary contents. + + + Option to include all properties from the log events + + Indicates whether to include call site (class and method name) in the information sent over the network. @@ -2385,9 +2409,9 @@ AppInfo field. By default it's the friendly name of the current AppDomain. - + - NDC item separator. + Renderer for log4j:event logger-xml-attribute (Default ${logger}) @@ -2993,9 +3017,11 @@ + + @@ -3028,6 +3054,11 @@ Option to include all properties from the log event (as JSON) + + + Option to include all properties from the log event (as JSON) + + Indicates whether to include contents of the dictionary. @@ -3043,6 +3074,11 @@ Indicates whether to include contents of the dictionary. + + + Indicates whether to include contents of the dictionary. + + How far should the JSON serializer follow object references before backing off @@ -3123,10 +3159,12 @@ + + @@ -3140,6 +3178,11 @@ Indicates whether to include call site (class and method name) in the information sent over the network. + + + Option to include all properties from the log events + + Indicates whether to include contents of the dictionary. @@ -3160,6 +3203,11 @@ Indicates whether to include contents of the stack. + + + Indicates whether to include contents of the dictionary. + + Indicates whether to include source info (file name and line number) in the information sent over the network. @@ -3186,34 +3234,46 @@ - - - - - - + + + + + + - - - - - - + + + + + + + + - - - List of property names to exclude when is true - - Option to include all properties from the log event (as XML) - + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use for rendering IList-collections items + + + + + How far should the XML serializer follow object references before backing off + + + Indicates whether to include contents of the dictionary. @@ -3223,24 +3283,14 @@ Indicates whether to include contents of the dictionary. - + - How far should the XML serializer follow object references before backing off + Indicates whether to include contents of the dictionary. - + - XML element name to use for rendering IList-collections items - - - - - XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included - - - - - XML element name to use when rendering properties + Option to include all properties from the log event (as XML) @@ -3248,24 +3298,14 @@ XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value - + - Name of the root XML element + List of property names to exclude when is true - + - Value inside the root XML element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - Auto indent and create new lines + XML element name to use when rendering properties @@ -3273,37 +3313,29 @@ Determines whether or not this attribute will be Xml encoded. + + + Auto indent and create new lines + + + + + Whether a ElementValue with empty value should be included in the output + + + + + Value inside the root XML element + + + + + Name of the root XML element + + - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Whether an attribute with empty value should be included in the output - - - @@ -3315,8 +3347,10 @@ + + @@ -3358,6 +3392,11 @@ Option to include all properties from the log event (as XML) + + + Option to include all properties from the log event (as XML) + + Indicates whether to include contents of the dictionary. @@ -3368,6 +3407,11 @@ Indicates whether to include contents of the dictionary. + + + Indicates whether to include contents of the dictionary. + + How far should the XML serializer follow object references before backing off @@ -3394,6 +3438,34 @@ + + + + + + + + + + Layout that will be rendered as the attribute's value. + + + + + Name of the attribute. + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Whether an attribute with empty value should be included in the output + + + diff --git a/MP-IO/packages.config b/MP-IO/packages.config index f2739eca..a3916368 100644 --- a/MP-IO/packages.config +++ b/MP-IO/packages.config @@ -33,9 +33,9 @@ - - - + + + diff --git a/MP-MAG/MP-MAG.csproj b/MP-MAG/MP-MAG.csproj index 58865caf..16ccabea 100644 --- a/MP-MAG/MP-MAG.csproj +++ b/MP-MAG/MP-MAG.csproj @@ -109,7 +109,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll diff --git a/MP-MAG/packages.config b/MP-MAG/packages.config index 4c84713a..8de07630 100644 --- a/MP-MAG/packages.config +++ b/MP-MAG/packages.config @@ -46,7 +46,7 @@ - + diff --git a/MP-Site/MP-Site.csproj b/MP-Site/MP-Site.csproj index c09b0014..93d94945 100644 --- a/MP-Site/MP-Site.csproj +++ b/MP-Site/MP-Site.csproj @@ -96,7 +96,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll diff --git a/MP-Site/packages.config b/MP-Site/packages.config index 1fcfd6b4..bdf5c67d 100644 --- a/MP-Site/packages.config +++ b/MP-Site/packages.config @@ -33,7 +33,7 @@ - + diff --git a/MP-TAB/MP-TAB.csproj b/MP-TAB/MP-TAB.csproj index 5ad81a7f..ca0aaf53 100644 --- a/MP-TAB/MP-TAB.csproj +++ b/MP-TAB/MP-TAB.csproj @@ -158,7 +158,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll diff --git a/MP-TAB/NLog.xsd b/MP-TAB/NLog.xsd index eefeec81..d1674723 100644 --- a/MP-TAB/NLog.xsd +++ b/MP-TAB/NLog.xsd @@ -457,19 +457,21 @@ - + + + - + - + @@ -552,16 +554,21 @@ NDLC item separator. + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + Indicates whether to include source info (file name and line number) in the information sent over the network. - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - Indicates whether to include NLog-specific extensions to log4j schema. @@ -587,6 +594,11 @@ Indicates whether to include dictionary contents. + + + Option to include all properties from the log events + + Indicates whether to include call site (class and method name) in the information sent over the network. @@ -602,9 +614,9 @@ AppInfo field. By default it's the friendly name of the current AppDomain. - + - NDC item separator. + Renderer for log4j:event logger-xml-attribute (Default ${logger}) @@ -2240,19 +2252,21 @@ - + + + - + - + @@ -2335,16 +2349,21 @@ NDLC item separator. + + + NDC item separator. + + + + + Indicates whether to include dictionary contents. + + Indicates whether to include source info (file name and line number) in the information sent over the network. - - - Renderer for log4j:event logger-xml-attribute (Default ${logger}) - - Indicates whether to include NLog-specific extensions to log4j schema. @@ -2370,6 +2389,11 @@ Indicates whether to include dictionary contents. + + + Option to include all properties from the log events + + Indicates whether to include call site (class and method name) in the information sent over the network. @@ -2385,9 +2409,9 @@ AppInfo field. By default it's the friendly name of the current AppDomain. - + - NDC item separator. + Renderer for log4j:event logger-xml-attribute (Default ${logger}) @@ -2993,9 +3017,11 @@ + + @@ -3028,6 +3054,11 @@ Option to include all properties from the log event (as JSON) + + + Option to include all properties from the log event (as JSON) + + Indicates whether to include contents of the dictionary. @@ -3043,6 +3074,11 @@ Indicates whether to include contents of the dictionary. + + + Indicates whether to include contents of the dictionary. + + How far should the JSON serializer follow object references before backing off @@ -3123,10 +3159,12 @@ + + @@ -3140,6 +3178,11 @@ Indicates whether to include call site (class and method name) in the information sent over the network. + + + Option to include all properties from the log events + + Indicates whether to include contents of the dictionary. @@ -3160,6 +3203,11 @@ Indicates whether to include contents of the stack. + + + Indicates whether to include contents of the dictionary. + + Indicates whether to include source info (file name and line number) in the information sent over the network. @@ -3186,34 +3234,46 @@ - - - - - - + + + + + + - - - - - - + + + + + + + + - - - List of property names to exclude when is true - - Option to include all properties from the log event (as XML) - + + + XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included + + + + + XML element name to use for rendering IList-collections items + + + + + How far should the XML serializer follow object references before backing off + + + Indicates whether to include contents of the dictionary. @@ -3223,24 +3283,14 @@ Indicates whether to include contents of the dictionary. - + - How far should the XML serializer follow object references before backing off + Indicates whether to include contents of the dictionary. - + - XML element name to use for rendering IList-collections items - - - - - XML attribute name to use when rendering property-key When null (or empty) then key-attribute is not included - - - - - XML element name to use when rendering properties + Option to include all properties from the log event (as XML) @@ -3248,24 +3298,14 @@ XML attribute name to use when rendering property-value When null (or empty) then value-attribute is not included and value is formatted as XML-element-value - + - Name of the root XML element + List of property names to exclude when is true - + - Value inside the root XML element - - - - - Whether a ElementValue with empty value should be included in the output - - - - - Auto indent and create new lines + XML element name to use when rendering properties @@ -3273,37 +3313,29 @@ Determines whether or not this attribute will be Xml encoded. + + + Auto indent and create new lines + + + + + Whether a ElementValue with empty value should be included in the output + + + + + Value inside the root XML element + + + + + Name of the root XML element + + - - - - - - - - - - Layout that will be rendered as the attribute's value. - - - - - Name of the attribute. - - - - - Determines whether or not this attribute will be Xml encoded. - - - - - Whether an attribute with empty value should be included in the output - - - @@ -3315,8 +3347,10 @@ + + @@ -3358,6 +3392,11 @@ Option to include all properties from the log event (as XML) + + + Option to include all properties from the log event (as XML) + + Indicates whether to include contents of the dictionary. @@ -3368,6 +3407,11 @@ Indicates whether to include contents of the dictionary. + + + Indicates whether to include contents of the dictionary. + + How far should the XML serializer follow object references before backing off @@ -3394,6 +3438,34 @@ + + + + + + + + + + Layout that will be rendered as the attribute's value. + + + + + Name of the attribute. + + + + + Determines whether or not this attribute will be Xml encoded. + + + + + Whether an attribute with empty value should be included in the output + + + diff --git a/MP-TAB/packages.config b/MP-TAB/packages.config index 67442a7c..6e2ecc10 100644 --- a/MP-TAB/packages.config +++ b/MP-TAB/packages.config @@ -33,9 +33,9 @@ - - - + + + diff --git a/MagData/MagData.csproj b/MagData/MagData.csproj index c11d2553..b2e267a8 100644 --- a/MagData/MagData.csproj +++ b/MagData/MagData.csproj @@ -74,7 +74,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\Pipelines.Sockets.Unofficial.2.2.2\lib\net461\Pipelines.Sockets.Unofficial.dll diff --git a/MagData/packages.config b/MagData/packages.config index 120fd6b4..d6aece77 100644 --- a/MagData/packages.config +++ b/MagData/packages.config @@ -10,7 +10,7 @@ - + diff --git a/MapoDb/MapoDb.csproj b/MapoDb/MapoDb.csproj index 5d3e4ce6..5a63b616 100644 --- a/MapoDb/MapoDb.csproj +++ b/MapoDb/MapoDb.csproj @@ -110,7 +110,7 @@ ..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll - ..\packages\NLog.4.7.13\lib\net45\NLog.dll + ..\packages\NLog.4.7.15\lib\net45\NLog.dll ..\packages\PDFsharp.1.50.5147\lib\net20\PdfSharp.dll diff --git a/MapoDb/packages.config b/MapoDb/packages.config index 9255b11e..09ae1544 100644 --- a/MapoDb/packages.config +++ b/MapoDb/packages.config @@ -14,7 +14,7 @@ - + From eacc1575b150aa06e376ec01ce163431e936262b Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 29 Apr 2022 09:56:54 +0200 Subject: [PATCH 3/9] Nuget update WebAPI --- MP-IO/MP-IO.csproj | 12 +- MP-IO/Web.config | 6 +- MP-IO/packages.config | 14 +- .../HelpPageSampleGenerator.cs | 289 ++++++++---------- MP-MAG/Areas/HelpPage/Views/Help/Index.cshtml | 46 ++- MP-MAG/Areas/HelpPage/Views/Web.config | 68 ++--- MP-MAG/Areas/HelpPage/Views/_ViewStart.cshtml | 6 +- MP-MAG/MP-MAG.csproj | 52 ++-- MP-MAG/Web.config | 14 +- MP-MAG/packages.config | 16 +- 10 files changed, 246 insertions(+), 277 deletions(-) diff --git a/MP-IO/MP-IO.csproj b/MP-IO/MP-IO.csproj index d9ae70b8..8e982d9c 100644 --- a/MP-IO/MP-IO.csproj +++ b/MP-IO/MP-IO.csproj @@ -141,8 +141,8 @@ ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.8\lib\net45\System.Net.Http.Formatting.dll @@ -194,11 +194,11 @@ ..\packages\Microsoft.AspNet.WebPages.3.2.8\lib\net45\System.Web.Helpers.dll - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.8\lib\net45\System.Web.Http.dll - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.8\lib\net45\System.Web.Http.WebHost.dll ..\packages\Microsoft.AspNet.Mvc.5.2.8\lib\net45\System.Web.Mvc.dll diff --git a/MP-IO/Web.config b/MP-IO/Web.config index f3101701..c1cfaf30 100644 --- a/MP-IO/Web.config +++ b/MP-IO/Web.config @@ -360,13 +360,13 @@ - + + - - + diff --git a/MP-IO/packages.config b/MP-IO/packages.config index a3916368..8c7544af 100644 --- a/MP-IO/packages.config +++ b/MP-IO/packages.config @@ -14,13 +14,13 @@ - - - - - - - + + + + + + + diff --git a/MP-MAG/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs b/MP-MAG/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs index 71aa8e80..64b655d1 100644 --- a/MP-MAG/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs +++ b/MP-MAG/Areas/HelpPage/SampleGeneration/HelpPageSampleGenerator.cs @@ -20,8 +20,6 @@ namespace MP_MAG.Areas.HelpPage /// public class HelpPageSampleGenerator { - #region Public Constructors - /// /// Initializes a new instance of the class. /// @@ -36,9 +34,10 @@ namespace MP_MAG.Areas.HelpPage }; } - #endregion Public Constructors - - #region Public Properties + /// + /// Gets CLR types that are used as the content of or . + /// + public IDictionary ActualHttpMessageTypes { get; internal set; } /// /// Gets the objects that are used directly as samples for certain actions. @@ -46,9 +45,9 @@ namespace MP_MAG.Areas.HelpPage public IDictionary ActionSamples { get; internal set; } /// - /// Gets CLR types that are used as the content of or . + /// Gets the objects that are serialized as samples by the supported formatters. /// - public IDictionary ActualHttpMessageTypes { get; internal set; } + public IDictionary SampleObjects { get; internal set; } /// /// Gets factories for the objects that the supported formatters will serialize as samples. Processed in order, @@ -63,138 +62,23 @@ namespace MP_MAG.Areas.HelpPage public IList> SampleObjectFactories { get; private set; } /// - /// Gets the objects that are serialized as samples by the supported formatters. + /// Gets the request body samples for a given . /// - public IDictionary SampleObjects { get; internal set; } - - #endregion Public Properties - - #region Private Methods - - // Default factory for sample objects - private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type) + /// The . + /// The samples keyed by media type. + public IDictionary GetSampleRequests(ApiDescription api) { - // Try to create a default sample object - ObjectGenerator objectGenerator = new ObjectGenerator(); - return objectGenerator.GenerateObject(type); + return GetSample(api, SampleDirection.Request); } - private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type) - { - switch (sampleDirection) - { - case SampleDirection.Request: - return formatter.CanReadType(type); - - case SampleDirection.Response: - return formatter.CanWriteType(type); - } - return false; - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] - private static string TryFormatJson(string str) - { - try - { - object parsedJson = JsonConvert.DeserializeObject(str); - return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); - } - catch - { - // can't parse JSON, return the original string - return str; - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] - private static string TryFormatXml(string str) - { - try - { - XDocument xml = XDocument.Parse(str); - return xml.ToString(); - } - catch - { - // can't parse XML, return the original string - return str; - } - } - - private static object WrapSampleIfString(object sample) - { - string stringSample = sample as string; - if (stringSample != null) - { - return new TextSample(stringSample); - } - - return sample; - } - - private IEnumerable> GetAllActionSamples(string controllerName, string actionName, IEnumerable parameterNames, SampleDirection sampleDirection) - { - HashSet parameterNamesSet = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); - foreach (var sample in ActionSamples) - { - HelpPageSampleKey sampleKey = sample.Key; - if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) && - String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) && - (sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) && - sampleDirection == sampleKey.SampleDirection) - { - yield return sample; - } - } - } - - #endregion Private Methods - - #region Internal Methods - - internal static Exception UnwrapException(Exception exception) - { - AggregateException aggregateException = exception as AggregateException; - if (aggregateException != null) - { - return aggregateException.Flatten().InnerException; - } - return exception; - } - - #endregion Internal Methods - - #region Public Methods - /// - /// Search for samples that are provided directly through . + /// Gets the response body samples for a given . /// - /// Name of the controller. - /// Name of the action. - /// The parameter names. - /// The CLR type. - /// The formatter. - /// The media type. - /// The value indicating whether the sample is for a request or for a response. - /// The sample that matches the parameters. - public virtual object GetActionSample(string controllerName, string actionName, IEnumerable parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection) + /// The . + /// The samples keyed by media type. + public IDictionary GetSampleResponses(ApiDescription api) { - object sample; - - // First, try to get the sample provided for the specified mediaType, sampleDirection, controllerName, actionName and parameterNames. - // If not found, try to get the sample provided for the specified mediaType, sampleDirection, controllerName and actionName regardless of the parameterNames. - // If still not found, try to get the sample provided for the specified mediaType and type. - // Finally, try to get the sample provided for the specified mediaType. - if (ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, parameterNames), out sample) || - ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, new[] { "*" }), out sample) || - ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, type), out sample) || - ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType), out sample)) - { - return sample; - } - - return null; + return GetSample(api, SampleDirection.Response); } /// @@ -252,7 +136,37 @@ namespace MP_MAG.Areas.HelpPage } /// - /// Gets the sample object that will be serialized by the formatters. + /// Search for samples that are provided directly through . + /// + /// Name of the controller. + /// Name of the action. + /// The parameter names. + /// The CLR type. + /// The formatter. + /// The media type. + /// The value indicating whether the sample is for a request or for a response. + /// The sample that matches the parameters. + public virtual object GetActionSample(string controllerName, string actionName, IEnumerable parameterNames, Type type, MediaTypeFormatter formatter, MediaTypeHeaderValue mediaType, SampleDirection sampleDirection) + { + object sample; + + // First, try to get the sample provided for the specified mediaType, sampleDirection, controllerName, actionName and parameterNames. + // If not found, try to get the sample provided for the specified mediaType, sampleDirection, controllerName and actionName regardless of the parameterNames. + // If still not found, try to get the sample provided for the specified mediaType and type. + // Finally, try to get the sample provided for the specified mediaType. + if (ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, parameterNames), out sample) || + ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, sampleDirection, controllerName, actionName, new[] { "*" }), out sample) || + ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType, type), out sample) || + ActionSamples.TryGetValue(new HelpPageSampleKey(mediaType), out sample)) + { + return sample; + } + + return null; + } + + /// + /// Gets the sample object that will be serialized by the formatters. /// First, it will look at the . If no sample object is found, it will try to create /// one using (which wraps an ) and other /// factories in . @@ -293,26 +207,6 @@ namespace MP_MAG.Areas.HelpPage return sampleObject; } - /// - /// Gets the request body samples for a given . - /// - /// The . - /// The samples keyed by media type. - public IDictionary GetSampleRequests(ApiDescription api) - { - return GetSample(api, SampleDirection.Request); - } - - /// - /// Gets the response body samples for a given . - /// - /// The . - /// The samples keyed by media type. - public IDictionary GetSampleResponses(ApiDescription api) - { - return GetSample(api, SampleDirection.Response); - } - /// /// Resolves the actual type of passed to the in an action. /// @@ -371,7 +265,6 @@ namespace MP_MAG.Areas.HelpPage type = requestBodyParameter == null ? null : requestBodyParameter.ParameterDescriptor.ParameterType; formatters = api.SupportedRequestBodyFormatters; break; - case SampleDirection.Response: default: type = api.ResponseDescription.ResponseType ?? api.ResponseDescription.DeclaredType; @@ -426,7 +319,6 @@ namespace MP_MAG.Areas.HelpPage } sample = new TextSample(serializedSampleString); - reader.Dispose(); } else { @@ -462,6 +354,91 @@ namespace MP_MAG.Areas.HelpPage return sample; } - #endregion Public Methods + internal static Exception UnwrapException(Exception exception) + { + AggregateException aggregateException = exception as AggregateException; + if (aggregateException != null) + { + return aggregateException.Flatten().InnerException; + } + return exception; + } + + // Default factory for sample objects + private static object DefaultSampleObjectFactory(HelpPageSampleGenerator sampleGenerator, Type type) + { + // Try to create a default sample object + ObjectGenerator objectGenerator = new ObjectGenerator(); + return objectGenerator.GenerateObject(type); + } + + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] + private static string TryFormatJson(string str) + { + try + { + object parsedJson = JsonConvert.DeserializeObject(str); + return JsonConvert.SerializeObject(parsedJson, Formatting.Indented); + } + catch + { + // can't parse JSON, return the original string + return str; + } + } + + [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Handling the failure by returning the original string.")] + private static string TryFormatXml(string str) + { + try + { + XDocument xml = XDocument.Parse(str); + return xml.ToString(); + } + catch + { + // can't parse XML, return the original string + return str; + } + } + + private static bool IsFormatSupported(SampleDirection sampleDirection, MediaTypeFormatter formatter, Type type) + { + switch (sampleDirection) + { + case SampleDirection.Request: + return formatter.CanReadType(type); + case SampleDirection.Response: + return formatter.CanWriteType(type); + } + return false; + } + + private IEnumerable> GetAllActionSamples(string controllerName, string actionName, IEnumerable parameterNames, SampleDirection sampleDirection) + { + HashSet parameterNamesSet = new HashSet(parameterNames, StringComparer.OrdinalIgnoreCase); + foreach (var sample in ActionSamples) + { + HelpPageSampleKey sampleKey = sample.Key; + if (String.Equals(controllerName, sampleKey.ControllerName, StringComparison.OrdinalIgnoreCase) && + String.Equals(actionName, sampleKey.ActionName, StringComparison.OrdinalIgnoreCase) && + (sampleKey.ParameterNames.SetEquals(new[] { "*" }) || parameterNamesSet.SetEquals(sampleKey.ParameterNames)) && + sampleDirection == sampleKey.SampleDirection) + { + yield return sample; + } + } + } + + private static object WrapSampleIfString(object sample) + { + string stringSample = sample as string; + if (stringSample != null) + { + return new TextSample(stringSample); + } + + return sample; + } } } \ No newline at end of file diff --git a/MP-MAG/Areas/HelpPage/Views/Help/Index.cshtml b/MP-MAG/Areas/HelpPage/Views/Help/Index.cshtml index 583f0f3e..ba100d04 100644 --- a/MP-MAG/Areas/HelpPage/Views/Help/Index.cshtml +++ b/MP-MAG/Areas/HelpPage/Views/Help/Index.cshtml @@ -6,41 +6,33 @@ @model Collection @{ - ViewBag.Title = "ASP.NET Web API Help Page"; + ViewBag.Title = "ASP.NET Web API Help Page"; - // Group APIs by controller - ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); + // Group APIs by controller + ILookup apiGroups = Model.ToLookup(api => api.ActionDescriptor.ControllerDescriptor); } -
-
-
-
+
+
-

@ViewBag.Title

+

@ViewBag.Title

-
-
-
-
-
-
-
-
+ +
+ -
+
+
@foreach (var group in apiGroups) { - @Html.DisplayFor(m => group, "ApiGroup") + @Html.DisplayFor(m => group, "ApiGroup") } -
-
-
-
\ No newline at end of file + +
diff --git a/MP-MAG/Areas/HelpPage/Views/Web.config b/MP-MAG/Areas/HelpPage/Views/Web.config index e94f4d66..6d4ddaf1 100644 --- a/MP-MAG/Areas/HelpPage/Views/Web.config +++ b/MP-MAG/Areas/HelpPage/Views/Web.config @@ -1,41 +1,41 @@  - - -
-
- - + + +
+
+ + - - - - - - - - - - - + + + + + + + + + + + - - - + + + - - - - - - - + + + + + + + - - - - - - - \ No newline at end of file + + + + + + + diff --git a/MP-MAG/Areas/HelpPage/Views/_ViewStart.cshtml b/MP-MAG/Areas/HelpPage/Views/_ViewStart.cshtml index d735b1cb..a9259508 100644 --- a/MP-MAG/Areas/HelpPage/Views/_ViewStart.cshtml +++ b/MP-MAG/Areas/HelpPage/Views/_ViewStart.cshtml @@ -1,4 +1,4 @@ -@{ - // Change the Layout path below to blend the look and feel of the help page with your existing web pages - Layout = "~/Views/Shared/_Layout.cshtml"; +@{ + // Change the Layout path below to blend the look and feel of the help page with your existing web pages. + Layout = "~/Areas/HelpPage/Views/Shared/_Layout.cshtml"; } \ No newline at end of file diff --git a/MP-MAG/MP-MAG.csproj b/MP-MAG/MP-MAG.csproj index 16ccabea..c9f7f691 100644 --- a/MP-MAG/MP-MAG.csproj +++ b/MP-MAG/MP-MAG.csproj @@ -159,6 +159,9 @@ ..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll + + ..\packages\Microsoft.AspNet.WebApi.Client.5.2.8\lib\net45\System.Net.Http.Formatting.dll + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll @@ -207,6 +210,12 @@ ..\packages\Microsoft.AspNet.WebPages.3.2.8\lib\net45\System.Web.Helpers.dll + + ..\packages\Microsoft.AspNet.WebApi.Core.5.2.8\lib\net45\System.Web.Http.dll + + + ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.8\lib\net45\System.Web.Http.WebHost.dll + ..\packages\Microsoft.AspNet.Mvc.5.2.8\lib\net45\System.Web.Mvc.dll @@ -234,17 +243,8 @@ True ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll - ..\packages\Microsoft.AspNet.Web.Optimization.1.1.3\lib\net40\System.Web.Optimization.dll @@ -795,24 +795,7 @@ - - - - - - - - - - - - - - - - - Always @@ -882,6 +865,23 @@ + + + + + + + + + + + + + + + + + diff --git a/MP-MAG/Web.config b/MP-MAG/Web.config index fcc410bd..e3522293 100644 --- a/MP-MAG/Web.config +++ b/MP-MAG/Web.config @@ -92,12 +92,7 @@ - - - - - - + @@ -106,7 +101,12 @@ - + + + + + + diff --git a/MP-MAG/packages.config b/MP-MAG/packages.config index 8de07630..6d2a5cc4 100644 --- a/MP-MAG/packages.config +++ b/MP-MAG/packages.config @@ -24,14 +24,14 @@ - - - - - - - - + + + + + + + + From 53905f8b814d87d9d4665cc2541bc8e3054ac181 Mon Sep 17 00:00:00 2001 From: Samuele Locatelli Date: Fri, 29 Apr 2022 10:00:11 +0200 Subject: [PATCH 4/9] Nuget update MongoDB --- MP-ADM/MP-ADM.csproj | 20 ++++++++++---------- MP-ADM/packages.config | 6 +++--- MP-IO/MP-IO.csproj | 24 ++++++++++++------------ MP-IO/packages.config | 6 +++--- MP-MAG/MP-MAG.csproj | 24 ++++++++++++------------ MP-MAG/packages.config | 6 +++--- MP-Site/MP-Site.csproj | 20 ++++++++++---------- MP-Site/packages.config | 6 +++--- MP-TAB/MP-TAB.csproj | 22 +++++++++++----------- MP-TAB/packages.config | 6 +++--- MagData/MagData.csproj | 16 ++++++++-------- MagData/packages.config | 6 +++--- MapoDb/MapoDb.csproj | 16 ++++++++-------- MapoDb/packages.config | 6 +++--- 14 files changed, 92 insertions(+), 92 deletions(-) diff --git a/MP-ADM/MP-ADM.csproj b/MP-ADM/MP-ADM.csproj index b51bf213..62f037ae 100644 --- a/MP-ADM/MP-ADM.csproj +++ b/MP-ADM/MP-ADM.csproj @@ -84,14 +84,14 @@ ..\packages\Microsoft.Web.RedisSessionStateProvider.4.0.1\lib\net462\Microsoft.Web.RedisSessionStateProvider.dll - - ..\packages\MongoDB.Bson.2.14.1\lib\netstandard2.0\MongoDB.Bson.dll + + ..\packages\MongoDB.Bson.2.15.0\lib\netstandard2.0\MongoDB.Bson.dll - - ..\packages\MongoDB.Driver.2.14.1\lib\netstandard2.0\MongoDB.Driver.dll + + ..\packages\MongoDB.Driver.2.15.0\lib\netstandard2.0\MongoDB.Driver.dll - - ..\packages\MongoDB.Driver.Core.2.14.1\lib\netstandard2.0\MongoDB.Driver.Core.dll + + ..\packages\MongoDB.Driver.Core.2.15.0\lib\netstandard2.0\MongoDB.Driver.Core.dll ..\packages\MongoDB.Libmongocrypt.1.3.0\lib\netstandard2.0\MongoDB.Libmongocrypt.dll @@ -511,12 +511,12 @@ + + - - @@ -1393,13 +1393,13 @@ - + - +