DHS.ICE.TechOps.AzureFunction.V8.Common
1.0.3
See the version list below for details.
dotnet add package DHS.ICE.TechOps.AzureFunction.V8.Common --version 1.0.3
NuGet\Install-Package DHS.ICE.TechOps.AzureFunction.V8.Common -Version 1.0.3
<PackageReference Include="DHS.ICE.TechOps.AzureFunction.V8.Common" Version="1.0.3" />
<PackageVersion Include="DHS.ICE.TechOps.AzureFunction.V8.Common" Version="1.0.3" />
<PackageReference Include="DHS.ICE.TechOps.AzureFunction.V8.Common" />
paket add DHS.ICE.TechOps.AzureFunction.V8.Common --version 1.0.3
#r "nuget: DHS.ICE.TechOps.AzureFunction.V8.Common, 1.0.3"
#:package DHS.ICE.TechOps.AzureFunction.V8.Common@1.0.3
#addin nuget:?package=DHS.ICE.TechOps.AzureFunction.V8.Common&version=1.0.3
#tool nuget:?package=DHS.ICE.TechOps.AzureFunction.V8.Common&version=1.0.3
A set of common utility tools for Azure Function in isolated mode with .Net8
A small program provides a set of utility tools, which makes programming easier for Azure Function with isolated mode.
Blob Storage Logger
This is a logger tool, which extends ILogger and ILoggerProvider and writes log entries into permenant blob storage.
In program.cs, add following codes
builder.Logging.AddProvider(new BlobStorageLoggerProvider());
or
.ConfigureLogging(logging =>
{
logging.AddProvider(new BlobStorageLoggerProvider());
})
If you do not want to or do not need add "RelevantId" for log entris, you are pretty much done!
In order to trace by "RelevantId", you can adopt one of the two ways below.
For a single log entry, try template method.
logger.LogInformation("Started job abc with {RelevantId}.", new { CaseNumber = caseNumber, RequestGuid = requestGuid });
For a section with multiple log entries, try the using block.
using (logger.BeginScope(new Dictionary<string, object> { ["RelevantId"] = new { CaseNumber = caseNumber, RequestGuid = requestGuid } }));
{
...
logger.LogInformation("Started job abc.");
...
logger.LogInformation("Finished job abc.");
}
For more advanced settings and usages, please review the source codes.
Resource Pool for Dyanmics 365 Service Client
This is an auto scaling resource pool for Dynamics 365 "ServiceClient" instances, which can overcome some design imperfectness for MS.
This component will allow you to use short-lived, scoped Dynamics 365 "ServiceClient" instances without worries about the socket depletion issue.
In program.cs, add following codes.
services.AddSingleton<IPooledServiceClientFactory>(new PooledServiceClientFactory(YOUR_CONNECTION_STRING));
In hosted service for start/stop handler, add following codes.
private readonly IPooledServiceClientFactory _pooledServiceClientFactory;
public HostStartupHandler(IPooledServiceClientFactory pooledServiceClientFactory)
{
_pooledServiceClientFactory = pooledServiceClientFactory;
}
public Task StartAsync(CancellationToken cancellationToken)
{
_pooledServiceClientFactory.Initialize();
return Task.CompletedTask;
}
Use the resource in your codes as following.
ServiceClient client = _pooledServiceClientFactory.Acquire();
try
{
...
}
finally
{
_pooledServiceClientFactory.Release(client);
}
For more advanced settings and usages, please review the source codes.
Blob Storage Factory and Service Bus Factory
MS does not provide an easy way for isolated mode to output multiple blob storage files and / or service bus messages.
Those two tools adopt a factory design pattern, which can minimize the connections to the back services with the same access token and allow you easily output multiple files and / or messages.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Azure.Messaging.ServiceBus (>= 7.19.0)
- Azure.Storage.Blobs (>= 12.24.0)
- Microsoft.AspNetCore.Mvc.Core (>= 2.3.0)
- Microsoft.Extensions.Logging (>= 9.0.4)
- Microsoft.PowerPlatform.Dataverse.Client (>= 1.2.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.