![]() |
VOOZH | about |
dotnet add package IsoBoiler --version 8.2.0
NuGet\Install-Package IsoBoiler -Version 8.2.0
<PackageReference Include="IsoBoiler" Version="8.2.0" />
<PackageVersion Include="IsoBoiler" Version="8.2.0" />Directory.Packages.props
<PackageReference Include="IsoBoiler" />Project file
paket add IsoBoiler --version 8.2.0
#r "nuget: IsoBoiler, 8.2.0"
#:package IsoBoiler@8.2.0
#addin nuget:?package=IsoBoiler&version=8.2.0Install as a Cake Addin
#tool nuget:?package=IsoBoiler&version=8.2.0Install as a Cake Tool
This package makes basic configuration of Azure Function Apps (isolated) easier.
All HostRunner methods will register Application Insights, but it won't trace anything unless a APPLICATIONINSIGHTS_CONNECTION_STRING is found in the environment variables. No error is thrown if it is not found.
//.RunBasicWithServices()
await HostRunner.RunWithServices((context, services) =>
{
services.Configure<AppSettings>(context.Configuration.GetSection("MyConfigFilter:AppSettings"));
services.AddHealthChecks();
services.AddScoped<IMyService, MyService>();
});
//.RunWithServices() -> Requires APP_CONFIG_ENDPOINT environment variable. Errors if not found
await HostRunner.RunWithServices((context, services) =>
{
services.Configure<AppSettings>(context.Configuration.GetSection("MyConfigFilter:AppSettings"));
services.AddHealthChecks();
services.AddScoped<IMyService, MyService>();
});
//May provide a Configuration Filter with .UseConfigurationFilter(), or a Configuration Snapshot with .UseConfigurationSnapshot()
await HostRunner.UseConfigurationFilter("MyFilter")
.UseConfigurationSnapshot("MySnapshot")
.RunWithServices((context, services) => { /* ...registering services... */});
//Automatically uses the last word in the project name as the Configuration Filter, i.e. "My.Glorious.Project" would use "Project"
var configuration = ConfigHelper.BuildConfiguration("https://appcs-myappconfigresource-env.azconfig.io");
//Provide a manual Configuration Filter
var configuration = ConfigHelper.BuildConfiguration("https://appcs-myappconfigresource-env.azconfig.io", "MyConfigurationFilter");
//Provide a Configuration Snapshot (must manually provide a Configuration Filter)
var configuration = ConfigHelper.BuildConfiguration("https://appcs-myappconfigresource-env.azconfig.io", "MyConfigurationFilter", "MyConfigurationSnapshot");
//Create App Settings model from a configuration
var appSettings = configuration.GetSettings<AppSettings>("Packing:AppSettings");
//All-in-one method to get settings (builds configuration within)
var appSettings = ConfigHelper.GetSettings<AppSettings>("https://appcs-myappconfigresource-env.azconfig.io", "Packing:AppSettings");
//Get the default service provider. This can be useful to get the default configured services, such as IObjectSerializer
var defaultServiceProvider = ConfigHelper.GetDefaultServiceProvider();
//Get a service provider with a custom configuration delegate so you can register services. May be useful when testing Dependency Injection
var serviceProvider = ConfigHelper.GetServiceProvider((context, services) =>
{
services.Configure<AppSettings>(context.Configuration.GetSection("MyProjectName:AppSettings"));
services.AddScoped<IMyService, MyService>();
});
//UseJsonAsConfiguration lets you provide configuration values as a string prior to creating your ServiceProvider.
var myConnectionString = "Server=myserver;Database=mydb;User Id=myuser;Password=mypassword;";
var appSettingsJson = $"{{\r\n \"AppSettings\": {{\r\n \"MyConnectionString\": \"{myConnectionString}\"\r\n }}\r\n}}";
var serviceProvider = ConfigHelper.UseJsonAsConfiguration(appSettingsJson).GetServiceProvider((context, services) =>
{
services.Configure<AppSettings>(context.Configuration.GetSection("AppSettings"));
});
var injectedAppSettings = serviceProvider.GetRequiredService<IOptionsSnapshot<AppSettings>>()!.Value;
//The Method name will automatically be used as the cacheKey, but one can be manually provided as well. This does not work (currently?) with Methods that require parameters in order to make sure that the function is executed lazily.
return await _memoryCache.Get(MyMethodName);
return await _memoryCache.Get("MyCacheKey", MyMethodName);
//Provide a lambda function that will produce the results you want. You must provide a cacheKey value to do this.
return await _memoryCache.Get("MyCacheKey", async () =>
{
using (var connection = new SqlConnection("MyConnectionString"))
using (var command = new SqlCommand()
{
CommandType = CommandType.StoredProcedure,
Connection = connection,
CommandText = "MyStoredProc"
})
{
var returnList = new List<MyDataModel>();
await connection.OpenAsync();
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
returnList.Add(new MyDataModel(reader));
}
}
await connection.CloseAsync();
return returnList;
}
});
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
This package is not used by any NuGet packages.
This package is not used by any popular GitHub repositories.