UtilPack.ResourcePooling.MSBuild 1.0.0

This project is a bridge between UtilPack.ResourcePooling project and custom MSBuild tasks.

Install-Package UtilPack.ResourcePooling.MSBuild -Version 1.0.0
dotnet add package UtilPack.ResourcePooling.MSBuild --version 1.0.0
<PackageReference Include="UtilPack.ResourcePooling.MSBuild" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add UtilPack.ResourcePooling.MSBuild --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: UtilPack.ResourcePooling.MSBuild, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install UtilPack.ResourcePooling.MSBuild as a Cake Addin
#addin nuget:?package=UtilPack.ResourcePooling.MSBuild&version=1.0.0

// Install UtilPack.ResourcePooling.MSBuild as a Cake Tool
#tool nuget:?package=UtilPack.ResourcePooling.MSBuild&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

UtilPack.ResourcePooling.MSBuild

Acting as a bridge between UtilPack.ResourcePooling project and MSBuild world, this project provides only one type, AbstractResourceUsingTask.
This type should be extended by MSBuild custom tasks, which intend to use the UtilPack.ResourcePooling project to deliver their functionality.
One such example of task is a task which dumps the contents of SQL file into the database.

The AbstractResourceUsingTask class implements canceability fully, and leaves two abstract methods for derived classes to implement.
Most of other methods are virtual, allowing derived classes to override them.

Abstract methods

CheckTaskParametersBeforeResourcePoolUsage

This method is used as a sanity check before actually starting to search for AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project.
The SQL dump running task could here e.g. check whether file exists.

UseResource

This method should perform the actual domain-specific functionality, using the resource it receives as parameter.
The SQL dump running task would here read the SQL statements from file and execute them using the resource (which would be of type SQLConnection).

Parameters

The AbstractResourceUsingTask introduces a number of task parameters, none of them statically marked as required, since most of the implementation can be overridden.
However, the default implementation, unless overridden, requires the following parameters:

  • PoolProviderPackageID of type String: should specify the NuGet package ID of the package holding type implementing the AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project.
  • PoolConfigurationFileContents of type String: sometimes it is more conventient to give configuration file contents directly, then this property should be used. This property takes precedence over PoolConfigurationFilePath.
  • PoolConfigurationFilePath of type String: should specify the path to JSON file containing serialized configuration for object passed as parameter to CreateOneTimeUseResourcePool method of AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. The Microsoft.Extensions.Configuration.Json package will be used to deserialize the value.

The default implementation, unless overridden, has the following optional parameters:

  • PoolProviderVersion of type String: the version part paired with PoolProviderPackageID, should specify the version of the NuGet package holding type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. If not specified, newest version will be used.
  • PoolProviderAssemblyPath of type String: the path within the NuGet package specified by PoolProviderPackageID and PoolProviderVersion parameters, where the assembly holding type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project resides. Is used only for NuGet packages with more than one assembly in their framework-specific folder.
  • PoolProviderTypeName of type String: once the assembly is loaded using PoolProviderPackageID, PoolProviderVersion and PoolProviderAssemblyPath parameters, this parameter may be used to specify the name of the type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. If left out, the first suitable type from all types defined in the assembly will be used.
  • RunSynchronously of type Boolean: this is infrastructure-related parameter, and actually is always used, since the usage is in non-virtual method. This parameter, if true, will skip calling Yield method.

Distribution

The NuGet package has the same package ID as this folder name.
The task provided by this project should be loaded using UtilPack.NuGet.MSBuild task factory.

UtilPack.ResourcePooling.MSBuild

Acting as a bridge between UtilPack.ResourcePooling project and MSBuild world, this project provides only one type, AbstractResourceUsingTask.
This type should be extended by MSBuild custom tasks, which intend to use the UtilPack.ResourcePooling project to deliver their functionality.
One such example of task is a task which dumps the contents of SQL file into the database.

The AbstractResourceUsingTask class implements canceability fully, and leaves two abstract methods for derived classes to implement.
Most of other methods are virtual, allowing derived classes to override them.

Abstract methods

CheckTaskParametersBeforeResourcePoolUsage

This method is used as a sanity check before actually starting to search for AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project.
The SQL dump running task could here e.g. check whether file exists.

UseResource

This method should perform the actual domain-specific functionality, using the resource it receives as parameter.
The SQL dump running task would here read the SQL statements from file and execute them using the resource (which would be of type SQLConnection).

Parameters

The AbstractResourceUsingTask introduces a number of task parameters, none of them statically marked as required, since most of the implementation can be overridden.
However, the default implementation, unless overridden, requires the following parameters:

  • PoolProviderPackageID of type String: should specify the NuGet package ID of the package holding type implementing the AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project.
  • PoolConfigurationFileContents of type String: sometimes it is more conventient to give configuration file contents directly, then this property should be used. This property takes precedence over PoolConfigurationFilePath.
  • PoolConfigurationFilePath of type String: should specify the path to JSON file containing serialized configuration for object passed as parameter to CreateOneTimeUseResourcePool method of AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. The Microsoft.Extensions.Configuration.Json package will be used to deserialize the value.

The default implementation, unless overridden, has the following optional parameters:

  • PoolProviderVersion of type String: the version part paired with PoolProviderPackageID, should specify the version of the NuGet package holding type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. If not specified, newest version will be used.
  • PoolProviderAssemblyPath of type String: the path within the NuGet package specified by PoolProviderPackageID and PoolProviderVersion parameters, where the assembly holding type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project resides. Is used only for NuGet packages with more than one assembly in their framework-specific folder.
  • PoolProviderTypeName of type String: once the assembly is loaded using PoolProviderPackageID, PoolProviderVersion and PoolProviderAssemblyPath parameters, this parameter may be used to specify the name of the type implementing AsyncResourceFactoryProvider type from UtilPack.ResourcePooling project. If left out, the first suitable type from all types defined in the assembly will be used.
  • RunSynchronously of type Boolean: this is infrastructure-related parameter, and actually is always used, since the usage is in non-virtual method. This parameter, if true, will skip calling Yield method.

Distribution

The NuGet package has the same package ID as this folder name.
The task provided by this project should be loaded using UtilPack.NuGet.MSBuild task factory.

Release Notes

Added property for specifying configuration file contents directly as string.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on UtilPack.ResourcePooling.MSBuild:

Package Downloads
CBAM.SQL.MSBuild
The Connection-Based Asynchronous Messaging (CBAM) SQL.MSbuild assembly contains abstract SQL-oriented MSBuild task, and task which reads file and executes SQL statements contained within.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.0.0 667 5/26/2018
1.0.0-RC4 533 10/18/2017
1.0.0-RC3 525 9/21/2017
1.0.0-RC2 481 9/21/2017
1.0.0-RC1 549 9/4/2017