Initial Commit after switching from SVN to git
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace MFR_RESTClient.generic;
|
||||
|
||||
public static class GenericExtensions
|
||||
{
|
||||
public static object? TryConvert(this string input, Type targetType)
|
||||
{
|
||||
try
|
||||
{
|
||||
var converter = TypeDescriptor.GetConverter(targetType);
|
||||
return converter?.ConvertFromString(context: null, culture: CultureInfo.InvariantCulture, text: input);
|
||||
}
|
||||
catch (NotSupportedException)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum EntityTypes
|
||||
{
|
||||
ItemType,
|
||||
ServiceRequest,
|
||||
Item,
|
||||
StockMovement,
|
||||
CostCenter,
|
||||
ItemUnit,
|
||||
TimeEvent,
|
||||
Document,
|
||||
Invoice,
|
||||
Report,
|
||||
Comment,
|
||||
Attachment,
|
||||
Appointment,
|
||||
Step,
|
||||
ServiceObject,
|
||||
StepListTemplate,
|
||||
StepListTemplateInstance,
|
||||
Contact,
|
||||
Tag,
|
||||
Product,
|
||||
Company,
|
||||
User,
|
||||
Qualification,
|
||||
none = -1
|
||||
}
|
||||
|
||||
public static class EntityHelper
|
||||
{
|
||||
public static string EntityName(EntityTypes et)
|
||||
{
|
||||
var ret = et.ToString().Replace("_", "-");
|
||||
return ret.StartsWith("-") ? ret[1..] : ret;
|
||||
}
|
||||
|
||||
public static EntityTypes EntityValue(string etname)
|
||||
{
|
||||
if (Enum.TryParse<EntityTypes>(etname, out var et))
|
||||
return et;
|
||||
|
||||
foreach (EntityTypes ty in Enum.GetValues<EntityTypes>())
|
||||
{
|
||||
if (string.Equals(ty.ToString(), etname, StringComparison.OrdinalIgnoreCase))
|
||||
return ty;
|
||||
}
|
||||
|
||||
return EntityTypes.none;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract class MFRItem
|
||||
{
|
||||
public Dictionary<string, string> Fields { get; set; }
|
||||
|
||||
protected MFRItem()
|
||||
{
|
||||
Fields = new Dictionary<string, string>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Abstractions;
|
||||
using RestSharp;
|
||||
using RestSharp.Authenticators;
|
||||
|
||||
namespace MFR_RESTClient;
|
||||
|
||||
public class MFRClient : IDisposable
|
||||
{
|
||||
private readonly RestClientOptions _clientOptions;
|
||||
private readonly RestClient _client;
|
||||
private readonly ILogger<MFRClient> _logger;
|
||||
public MFRClientConfig ClientConfig { get; }
|
||||
private readonly MFRClientCredentials _clientCredentials;
|
||||
public bool IsReadonly { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Get or set a value indicating the exceptions thrown by the client should be hidden.
|
||||
/// </summary>
|
||||
public bool HideCustomExceptions { get; set; }
|
||||
|
||||
public string DownloadUserAgent { get; set; } = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:88.0) Gecko/20100101 Firefox/88.0";
|
||||
|
||||
/// <summary>
|
||||
/// Construct with typed config and credentials.
|
||||
/// </summary>
|
||||
public MFRClient(MFRClientConfig config, MFRClientCredentials credentials, ILogger<MFRClient>? logger = null)
|
||||
{
|
||||
_logger = logger ?? NullLogger<MFRClient>.Instance;
|
||||
ClientConfig = config;
|
||||
_clientCredentials = credentials;
|
||||
_clientOptions = new RestClientOptions
|
||||
{
|
||||
Authenticator = new HttpBasicAuthenticator(_clientCredentials.Username, _clientCredentials.Password)
|
||||
};
|
||||
_client = new RestClient(_clientOptions);
|
||||
}
|
||||
|
||||
public async Task<string> ReadAnything(string address, bool throwErrorIfNotOk = true)
|
||||
{
|
||||
var request = new RestRequest(resource: address, method: Method.Get);
|
||||
var response = await Execute(request, "ReadAnything", throwErrorIfNotOk);
|
||||
return response.Content ?? "";
|
||||
}
|
||||
|
||||
public async Task<ODataEnvelope> ReadOData(string address, bool throwErrorIfNotOk = true)
|
||||
{
|
||||
var request = new RestRequest(resource: address, method: Method.Get);
|
||||
var response = await Execute(request, "ReadOData", throwErrorIfNotOk);
|
||||
return new ODataEnvelope(response.Content, url: address);
|
||||
}
|
||||
|
||||
public byte[]? GetFile(string address, bool throwErrorIfNotOk = true)
|
||||
{
|
||||
byte[]? data = null;
|
||||
using var httpClient = new HttpClient();
|
||||
httpClient.DefaultRequestHeaders.UserAgent.ParseAdd(DownloadUserAgent);
|
||||
var credentials = Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes($"{_clientCredentials.Username}:{_clientCredentials.Password}"));
|
||||
httpClient.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", credentials);
|
||||
try
|
||||
{
|
||||
data = httpClient.GetByteArrayAsync(new Uri(address)).GetAwaiter().GetResult();
|
||||
}
|
||||
catch (HttpRequestException ex)
|
||||
{
|
||||
_logger.LogWarning(ex, "GetFile failed with HttpRequestException — address={Address}", address);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// Swallow
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
public async Task<string> GetEntities(bool throwErrorIfNotOk = true)
|
||||
{
|
||||
var request = new RestRequest(resource: ClientConfig.BaseUrl, method: Method.Get);
|
||||
request.AddHeader("Accept", "application/json");
|
||||
var response = await Execute(request, "get anything", throwErrorIfNotOk);
|
||||
return response.Content ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes a query against MFR.
|
||||
/// </summary>
|
||||
private async Task<RestResponse> Execute(RestRequest request, string message, bool throwErrorIfNotOk)
|
||||
{
|
||||
var response = await _client.ExecuteAsync(request);
|
||||
|
||||
bool notFound = response.StatusCode == HttpStatusCode.InternalServerError
|
||||
&& (response.Content?.IndexOf("Sequence contains no elements", 0, StringComparison.InvariantCultureIgnoreCase) ?? -1) > -1;
|
||||
|
||||
if (throwErrorIfNotOk
|
||||
&& response.StatusCode != HttpStatusCode.OK
|
||||
&& response.StatusCode != HttpStatusCode.Created
|
||||
&& !notFound)
|
||||
{
|
||||
_logger.LogWarning("Execute rest issue: {Message} — status={Status}, resource={Resource}",
|
||||
message, response.StatusDescription, request.Resource);
|
||||
ThrowExceptionIfNecessary(response, "Execute", $"{message}{Environment.NewLine}{response.StatusDescription}");
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private void ThrowExceptionIfNecessary(RestResponse response, string location, string? customMessage = null)
|
||||
{
|
||||
if (!HideCustomExceptions)
|
||||
{
|
||||
var msg = customMessage != null
|
||||
? $"Error in {location}:{customMessage} {response.ErrorMessage}"
|
||||
: $"Error in {location} {response.ErrorMessage}";
|
||||
throw new MFRClientException(response.StatusCode, msg, response.Content ?? "");
|
||||
}
|
||||
}
|
||||
|
||||
#region IDisposable
|
||||
|
||||
private bool _disposed;
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_client?.Dispose();
|
||||
}
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(disposing: true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public static class HtmlCleanUp
|
||||
{
|
||||
/// <summary>
|
||||
/// Cleanse HTML tags and other detritus from the string to make it plaintext.
|
||||
/// </summary>
|
||||
public static string Clean(string source)
|
||||
{
|
||||
var withoutLineBreaks = Regex.Replace(source, "\n", string.Empty);
|
||||
var withParagraphBreaks = Regex.Replace(withoutLineBreaks, "</?(p|br|div) *[^>]*>", "\n");
|
||||
var tagsRemoved = Regex.Replace(withParagraphBreaks, "<[^>]*>", string.Empty);
|
||||
var removeCrs = Regex.Replace(tagsRemoved, "\r", string.Empty);
|
||||
var multiLineBreaksRemoved = Regex.Replace(removeCrs, "\n+", "\n");
|
||||
var leadingLineBreakRemoved = Regex.Replace(multiLineBreaksRemoved, "^\n", string.Empty);
|
||||
var trailingLineBreakRemoved = Regex.Replace(leadingLineBreakRemoved, "\n$", string.Empty);
|
||||
return HttpUtility.HtmlDecode(trailingLineBreakRemoved);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Net;
|
||||
|
||||
namespace MFR_RESTClient;
|
||||
|
||||
public class MFRClientConfig
|
||||
{
|
||||
public string BaseUrl { get; } = "";
|
||||
|
||||
public MFRClientConfig(string url)
|
||||
{
|
||||
BaseUrl = url.StartsWith("http") ? url : $"https://{url.Trim()}/odata/";
|
||||
if (!BaseUrl.EndsWith("/")) BaseUrl += "/";
|
||||
}
|
||||
|
||||
public bool IsLogoutRequired { get; set; } = false;
|
||||
public bool IsSessionRequired { get; set; } = false;
|
||||
public string LoginAddress { get; set; } = "";
|
||||
public string LogoutAddress { get; set; } = "";
|
||||
public string SessionAddress { get; set; } = "";
|
||||
public string IsAuthenticatedAddress { get; set; } = "";
|
||||
public string TokenCookieName { get; set; } = "";
|
||||
public string SessionCookieName { get; set; } = "";
|
||||
}
|
||||
|
||||
public class MFRClientCredentials
|
||||
{
|
||||
public string Username { get; } = "";
|
||||
public string Password { get; } = "";
|
||||
|
||||
public MFRClientCredentials(string username, string password)
|
||||
{
|
||||
Username = username;
|
||||
Password = password;
|
||||
}
|
||||
}
|
||||
|
||||
public class MFRClientException : Exception
|
||||
{
|
||||
public string Error { get; set; }
|
||||
public string Content { get; set; }
|
||||
public HttpStatusCode StatusCode { get; set; }
|
||||
|
||||
public MFRClientException(HttpStatusCode statusCode, string error, string content, Exception? innerException = null)
|
||||
: base(message: error, innerException: innerException)
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Error = error;
|
||||
Content = content;
|
||||
}
|
||||
}
|
||||
|
||||
public class MFRController { }
|
||||
@@ -0,0 +1,46 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<RootNamespace>MFR_RESTClient</RootNamespace>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<Configurations>db-dev.processweb.de;Debug;Release;server02.processweb.de</Configurations>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DocumentationFile>MFR_RESTClient.xml</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DocumentationFile>MFR_RESTClient.xml</DocumentationFile>
|
||||
<NoWarn>1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<!-- Compatible packages (kept) -->
|
||||
<PackageReference Include="Microsoft.AspNet.SignalR.Client" Version="2.4.3" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="6.0.0" />
|
||||
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
|
||||
<PackageReference Include="Microsoft.Data.Edm" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.Data.OData" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.Data.Services.Client" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.NETCore.Targets" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
|
||||
<PackageReference Include="System.Spatial" Version="5.8.5" />
|
||||
<!-- Updated packages -->
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.6" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.17.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="RestSharp" Version="114.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
|
||||
<!-- New packages (replacements) -->
|
||||
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.20.1" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.6" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.6" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.6" />
|
||||
<!-- Deprecated but kept for compatibility (review in follow-up) -->
|
||||
<PackageReference Include="Microsoft.IdentityModel.Abstractions" Version="8.17.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="8.17.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.17.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,79 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<OutputType>Library</OutputType>
|
||||
<MyType>Empty</MyType>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<Configurations>db-dev.processweb.de;Debug;Release;server02.processweb.de</Configurations>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DocumentationFile>MFR_RESTClient.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DocumentationFile>MFR_RESTClient.xml</DocumentationFile>
|
||||
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Update="My Project\Application.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Application.myapp</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Update="My Project\Application.myapp">
|
||||
<Generator>MyApplicationCodeGenerator</Generator>
|
||||
<LastGenOutput>Application.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Compile items now included by globbing that were not in the original project file">
|
||||
<Compile Remove="MFRClientSessionManagement.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="MFR_RESTClient.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!-- Compatible packages (kept) -->
|
||||
<PackageReference Include="Microsoft.AspNet.SignalR.Client" Version="2.4.3" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.9" />
|
||||
<PackageReference Include="Microsoft.Azure.Services.AppAuthentication" Version="1.6.2" />
|
||||
<PackageReference Include="Microsoft.Data.Edm" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.Data.OData" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.Data.Services.Client" Version="5.8.5" />
|
||||
<PackageReference Include="Microsoft.NETCore.Targets" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.Rest.ClientRuntime" Version="2.3.24" />
|
||||
<PackageReference Include="System.Private.Uri" Version="4.3.2" />
|
||||
<PackageReference Include="System.Spatial" Version="5.8.5" />
|
||||
<!-- Updated packages -->
|
||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.5" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.17.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="RestSharp" Version="114.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.17.0" />
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.1.2" />
|
||||
<PackageReference Include="System.Text.Encodings.Web" Version="10.0.5" />
|
||||
<PackageReference Include="System.Text.Json" Version="10.0.5" />
|
||||
<!-- New packages (replacements) -->
|
||||
<PackageReference Include="Azure.Messaging.ServiceBus" Version="7.20.1" />
|
||||
<PackageReference Include="Microsoft.Data.SqlClient" Version="7.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.5.25277.114" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="10.0.0-preview.5.25277.114" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="10.0.5" />
|
||||
<!-- Deprecated but kept for compatibility (review in follow-up) -->
|
||||
<PackageReference Include="Microsoft.IdentityModel.Abstractions" Version="8.17.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Clients.ActiveDirectory" Version="5.3.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Logging" Version="8.17.0" />
|
||||
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.17.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectView>ShowAllFiles</ProjectView>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0"?>
|
||||
<doc>
|
||||
<assembly>
|
||||
<name>MFR_RESTClient</name>
|
||||
</assembly>
|
||||
<members>
|
||||
<member name="P:MFR_RESTClient.MFRClient.HideCustomExceptions">
|
||||
<summary>
|
||||
Get or set a value indicating the exceptions thrown by the client should be hidden.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:MFR_RESTClient.MFRClient.#ctor(MFR_RESTClient.MFRClientConfig,MFR_RESTClient.MFRClientCredentials,Microsoft.Extensions.Logging.ILogger{MFR_RESTClient.MFRClient})">
|
||||
<summary>
|
||||
Construct with typed config and credentials.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:MFR_RESTClient.MFRClient.Execute(RestSharp.RestRequest,System.String,System.Boolean)">
|
||||
<summary>
|
||||
Executes a query against MFR.
|
||||
</summary>
|
||||
</member>
|
||||
<member name="M:MFR_RESTClient.HtmlCleanUp.Clean(System.String)">
|
||||
<summary>
|
||||
Cleanse HTML tags and other detritus from the string to make it plaintext.
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
@@ -0,0 +1,53 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MFR_RESTClient;
|
||||
|
||||
public class ODataEnvelope
|
||||
{
|
||||
public string Url { get; set; } = "";
|
||||
public Uri? Metadata { get; set; }
|
||||
public object? Value { get; set; }
|
||||
public Uri? NextLink { get; set; }
|
||||
public string? ErrorMessage { get; set; }
|
||||
|
||||
public ODataEnvelope(string? contentString, string url = "")
|
||||
{
|
||||
if (!string.IsNullOrEmpty(contentString))
|
||||
{
|
||||
var dict = JsonConvert.DeserializeObject<Dictionary<string, object>>(contentString);
|
||||
if (dict != null)
|
||||
{
|
||||
if (dict.TryGetValue("odata.metadata", out var metaVal)
|
||||
&& metaVal?.ToString()?.StartsWith("http") == true)
|
||||
{
|
||||
Metadata = new Uri(metaVal.ToString()!);
|
||||
}
|
||||
|
||||
if (dict.TryGetValue("odata.nextLink", out var nextVal)
|
||||
&& nextVal?.ToString()?.StartsWith("http") == true)
|
||||
{
|
||||
NextLink = new Uri(nextVal.ToString()!);
|
||||
}
|
||||
|
||||
if (dict.TryGetValue("value", out var val))
|
||||
{
|
||||
Value = val;
|
||||
}
|
||||
else if (dict.Count > 0)
|
||||
{
|
||||
Value = JsonConvert.DeserializeObject(contentString);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(url)) Url = url;
|
||||
}
|
||||
|
||||
public void ConvertToArray()
|
||||
{
|
||||
if (Value != null && Value.GetType() != typeof(JArray))
|
||||
{
|
||||
Value = new JArray(Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<section name="MFR_RESTClient.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<appSettings>
|
||||
<add key="ClientSettingsProvider.ServiceUri" value="" />
|
||||
</appSettings>
|
||||
<system.web>
|
||||
<membership defaultProvider="ClientAuthenticationMembershipProvider">
|
||||
<providers>
|
||||
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
|
||||
</providers>
|
||||
</membership>
|
||||
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
|
||||
<providers>
|
||||
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />
|
||||
</providers>
|
||||
</roleManager>
|
||||
</system.web>
|
||||
<userSettings>
|
||||
<MFR_RESTClient.My.MySettings>
|
||||
</MFR_RESTClient.My.MySettings>
|
||||
</userSettings>
|
||||
<system.serviceModel>
|
||||
<extensions>
|
||||
<!-- In this extension section we are introducing all known service bus extensions. User can remove the ones they don't need. -->
|
||||
<behaviorExtensions>
|
||||
<add name="connectionStatusBehavior" type="Microsoft.ServiceBus.Configuration.ConnectionStatusElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="transportClientEndpointBehavior" type="Microsoft.ServiceBus.Configuration.TransportClientEndpointBehaviorElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="serviceRegistrySettings" type="Microsoft.ServiceBus.Configuration.ServiceRegistrySettingsElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</behaviorExtensions>
|
||||
<bindingElementExtensions>
|
||||
<add name="netMessagingTransport" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingTransportExtensionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="tcpRelayTransport" type="Microsoft.ServiceBus.Configuration.TcpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="httpRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="httpsRelayTransport" type="Microsoft.ServiceBus.Configuration.HttpsRelayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="onewayRelayTransport" type="Microsoft.ServiceBus.Configuration.RelayedOnewayTransportElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</bindingElementExtensions>
|
||||
<bindingExtensions>
|
||||
<add name="basicHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.BasicHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="webHttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WebHttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="ws2007HttpRelayBinding" type="Microsoft.ServiceBus.Configuration.WS2007HttpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="netTcpRelayBinding" type="Microsoft.ServiceBus.Configuration.NetTcpRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="netOnewayRelayBinding" type="Microsoft.ServiceBus.Configuration.NetOnewayRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="netEventRelayBinding" type="Microsoft.ServiceBus.Configuration.NetEventRelayBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<add name="netMessagingBinding" type="Microsoft.ServiceBus.Messaging.Configuration.NetMessagingBindingCollectionElement, Microsoft.ServiceBus, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
</bindingExtensions>
|
||||
</extensions>
|
||||
</system.serviceModel>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Azure.Services.AppAuthentication" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.6.2.0" newVersion="1.6.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.IdentityModel.Tokens.Jwt" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.2.0" newVersion="7.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Clients.ActiveDirectory" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.1.4.0" newVersion="4.1.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Tokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.2.0" newVersion="7.0.2.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.Logging" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.11.0.0" newVersion="6.11.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.IdentityModel.JsonWebTokens" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.11.0.0" newVersion="6.11.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.3" newVersion="7.0.0.3" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-7.0.0.0" newVersion="7.0.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user