BassUtils.NetCore 4.1.0-alpha

This is a prerelease version of BassUtils.NetCore.
There is a newer version of this package available.
See the version list below for details.
dotnet add package BassUtils.NetCore --version 4.1.0-alpha
NuGet\Install-Package BassUtils.NetCore -Version 4.1.0-alpha
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BassUtils.NetCore" Version="4.1.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add BassUtils.NetCore --version 4.1.0-alpha
#r "nuget: BassUtils.NetCore, 4.1.0-alpha"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install BassUtils.NetCore as a Cake Addin
#addin nuget:?package=BassUtils.NetCore&version=4.1.0-alpha&prerelease

// Install BassUtils.NetCore as a Cake Tool
#tool nuget:?package=BassUtils.NetCore&version=4.1.0-alpha&prerelease

BassUtils

Low-level utility functions for use in any .Net Standard 2.0 project.

BassUtils.NetCore

Low-level utility functions for use in any .Net Core 3.1 and later project.

Change History

[4.1.0]
Added (BassUtils)
  • Added IDataReader.ReadOne() method.
  • Added RuntimeInformation classes.
Added (BassUtils.NetCore)
  • Added BassUtils.NetCore downstream library.
[4.0.0]
Changed
  • Upgraded to Net Standard 2.0.
  • Some things moved to sub-namespaces 'Data' and 'MsSql'.
  • IniData remains, but the recommendation in its doc-comment has changed to reference ini-parser-netstandard.
  • StreamExtensions.ReadFully has become ReadToEnd.
  • The SqlBulkCopyDataReader class now targets Microsoft.Data.SqlClient, not System.Data.SqlClient. See https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/ for background. This means that BassUtils now has a dependency on the Microsoft.Data.SqlClient package.
  • CSV has been changed to 'Csv' for compliance with Microsoft recommended naming standards.
  • GetLeadingNumber and GetTrailingNumber have had their APIs change, and they now work!
  • Regularzie naming in IDataRecordExtensions: GetSingle becomes GetFloat, GetStringOrNull becomes GetNullableString, GetValueOrNull becomes GetNullableValue.
Removed
  • Various utilities have been removed due to better alternatives now becoming available in the community or me simply not making any use of them.
  • ArgumentValidators - use Dawn.Guard instead (this library includes it as a dependency).
  • Glob - use Microsoft.Extensions.FileSystemGlobbing
  • Partition and DistinctBy methods - use MoreLinq.
  • ConfigurationLoader, DoubleExtensions, ExpandoExtensions, PredicateBuilder, PropertyCopier, TableAdapterBase, ThrottledBlockingQueue, XmlWriterExtensions have been removed.
  • Removed the Hydate and HydrateAll functions that use reflection to guess a ctor to call. Use the overloads that take a lambda instead, they are more predictable.
[3.1.0]
Fixed
  • Make AssemblyExtensions.GetResourceFileName work in ILMerge scenarios by searching for names by partial match if an exact match cannot be found. Still requires unique names.
Added
  • Take the existing AppendCSV functionality and move it to be extensions to the TextWriter class, therefore making it available for use in StreamWriter and StringWriter classes. Also extend the CSVOptions so that the class writes CSV that is more in line with the unofficial CSV specification as described on Wikipedia; in particular see the Standardization section.
  • Add [DebuggerStepThrough] attributes to the ArgumentValidators.
[3.0.0] - 2015-10-29
Fixed
  • In PropertyCopier, only write to properties with a setter.
Added
  • StringExtensions.TrimAll, RemoveNewLines, ContainsAll.
  • New overload of StringExtensions.SafeFormat that defaults to InvariantCulture.
  • New Glob class (Unix-like file globber)
  • IEnumerableExtensions.DistinctBy.
  • ConfigurationLoader.CanLoad method.
Changed
  • IniParser has been refactored into IniData and IniSection classes, and a static Parse method is now the starting point. Tests added, and the ability to parse INI files with duplicate keys and valueless keys added (based on data seen in real-life INI files). This change is the reason for the bump in the version number.
[2.2.1] - 2015-04-27
Fixed
  • Bug fix in ConfigurationLoader regarding multiple named sections.
[2.2.0] - 2015-04-26
Added
  • Built 4.0 and 4.5 versions of the assembly.
  • Gave ConfigurationLoader the ability to load a section by name, so you can use the same type to load several different (named!) configuration sections.
  • AppDomainExtensions.IsLoaded
  • FileUtils.GetExeDirectory, NormalizeToExeDirectory, NormalizeToDirectory.
  • IEnumerableExtensions.ToHashSet.
[2.1.0] - 2015-04-18
Added
  • StringExtensions.SetChar
  • StringBuilderExtensions.EndsWith, AppendCSV, AppendIfDoesNotEndWith, TrimAppend
  • StringExtensions.AppendCSV, AppendIfDoesNotEndWith, TrimAppend
  • ConfigurationLoader (see documentation in the class or BassUtils.Tests)
[2.0.0] - 2015-03-25
Added
  • PropertyCopier, ThrottledBlockingQueue, ICollectionExtensions.
  • More XML documentation for methods.
Removed
[1.1.1] - 2015-03-23
Added
  • XML documentation for most functions and classes.
[1.1.0] - 2015-03-19
Added
  • Conv.StringToBest function.

Highlights (not exhaustive)

AssemblyExtensions Get embedded resources:

string sql = typeof(this).Assembly.GetResourceAsString("Foo.sql");

Comb Generate Guids in a monotonic way for SQL server that will not lead to index fragmentation:

Guid g = Comb.NewGuid();

Conv Convenient conversion functions:

int x = Conv.StringToBest("42");

DirectoryWatcher A wrapper around FileSystemWatcher that will de-duplicate events.

IDataReaderExtensions, IDataRecordExtensions Many extensions to make working with these classes more convenient, including extensions to get columns by name, get columns with defaults if null, and get nullable columns. Also includes convenient Hydrate() methods to create entities.

IndentingStringBuilder A wrapper around StringBuilder that can create indented text. Handy for code generation.

IniData A simple parser for INI files.

ObjectDataReader A very useful class that can wrap any class in an IDataReader, making it possible to bind to it, use SqlBulkCopy etc. Often used in conjunction with the SqlBulkCopyDataReader to perform validation on fields before bulk inserting them:

var orders = new List<Order>();
...
using (var orderReader = new ObjectDataReader(orders))
using (var bulkCopy = new SqlBulkCopy(conn) { DestinationTableName = "dbo.Orders" })
using (var sbcReader = new SqlBulkCopyDataReader(orderReader, conn, bulkCopy))
{
    bulkCopy.WriteToServer(sbcReader);
}

SqlBulkCopyExtensions An extension to get the number of rows uploaded:

int numRows = bulkCopy.TotalRowsCopied();

StringExtensions Some handy string extensions:

string key = "Name=Phil".Before("=");
string value = "Name=Phil".After("=");
string s = "Hello".Repeat(3);
string t = "hi".Left(3); // safe.

// Simple CSV-like "listifier". Also on StringBuilder and TextWriter.
string list = "".AppendCsv(number, name, street, town, county, country);
list = "Hello,".AppendIfDoesNotEndWith(",");
list = list.TrimAppend("  world  ");
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.7.0 1,643 1/19/2023
4.6.0 1,735 2/12/2022
4.5.0 280 1/11/2022
4.4.2 241 1/1/2022
4.4.1 212 12/28/2021
4.2.4-alpha-g3e4abfb12d 170 12/17/2021
4.2.2-alpha-g73bc890b96 168 12/16/2021
4.2.1-alpha-gd2c57a210b 176 12/16/2021
4.1.12 5,454 11/24/2021
4.1.0-alpha 158 11/9/2021

2021-11-08 Create BassUtils.NetCore package.