MMDHelpers.CSharp
1.0.2
See the version list below for details.
dotnet add package MMDHelpers.CSharp --version 1.0.2
NuGet\Install-Package MMDHelpers.CSharp -Version 1.0.2
<PackageReference Include="MMDHelpers.CSharp" Version="1.0.2" />
paket add MMDHelpers.CSharp --version 1.0.2
#r "nuget: MMDHelpers.CSharp, 1.0.2"
// Install MMDHelpers.CSharp as a Cake Addin #addin nuget:?package=MMDHelpers.CSharp&version=1.0.2 // Install MMDHelpers.CSharp as a Cake Tool #tool nuget:?package=MMDHelpers.CSharp&version=1.0.2
MMDHelpers.CSharp
This project is a collection of helpers that i've been using across multiple projects
Feedbacks are always welcome 😄
Some of the code are production ready, and some are just experimentations
Projects and purpose
- [Nuget] MMDHelpers.CSharp - simple helpers, you should avoid those if your application need to be high performance GC is not verified.
- [Nuget] MMDHelpers.CSharp.LDAP - simple abstraction to login on a LDAP service.
- [Nuget] MMDHelpers.CSharp.LocalData - generates a localDB, uses dapper as micro-orm.
- [Nuget] MMDHelpers.CSharp.Performance.Grpc - An example to use Grpc to measure Performance (not ideally, but just enough to get the evident ones)
- MMDHelpers.CSharp.Performance.GrpcClient - A client to control the server.
- [Nuget] MMDHelpers.CSharp.PerformanceChecks - Just shows the GC Collection and workingSet being used.
MMDHelpers.CSharp
WriteToFile
As i mentioned before, there are better solutions like Log4net, Serilog, NLog but for small projects or just to Test this is enough.
////An Example on Application
public static void Write(string filename, params string[] texts)
{
if (texts.Length == 0) return;
lock (sync)
{
filename
.ToCurrentPath()
.WriteToFile(new List<string>(texts.Length) { string.Join("", texts.Select(c => $"{DateTime.Now} - {c} {Environment.NewLine}")) });
}
}
////Usage:
Write("somefile.log","test 1", "test 2");
AsDataTable
As the Example Above this will be enough when your collection is small around 10-150k. beware it'll have overhead, as internally i'm using reflection to get types.
public void SomeMethodToBulkInsert<T>(IEnumerable<T> somelist )
using (var conn = new SqlConnection("someconn"))
{
conn.Open();
var transaction = conn.BeginTransaction();
using (var bulkCopy = new SqlBulkCopy(conn, SqlBulkCopyOptions.Default, transaction))
{
bulkCopy.BatchSize = 500;
bulkCopy.DestinationTableName = "dbo.someTable";
try
{
SqlBulkCopyColumnMapping someColumn = new SqlBulkCopyColumnMapping("source", "destination");
bulkCopy.ColumnMappings.Add(someColumn);
bulkCopy.WriteToServer(somelist.Select(q => new { q.someColumn }).AsDataTable());
transaction.Commit();
}
catch (Exception ex)
{
transaction.Rollback();
}
}
}
MMDHelpers.CSharp.PerformanceChecks
If you need high performant tools to analyze your code, i recommend my Book of Reference. there i'm collecting Articles, tools to those scenarios.
Ruler.StartMeasuring(false);
Ruler.StopMeasuring(false);
Ruler.Show(true);
Ruler.LogToFile();
Product | Versions 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 | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MMDHelpers.CSharp:
Package | Downloads |
---|---|
MMDHelpers.CSharp.LocalData
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
4.0.0 | 233 | 9/5/2023 |
3.0.2 | 670 | 9/13/2021 |
3.0.1 | 406 | 9/10/2021 |
3.0.0 | 397 | 9/10/2021 |
2.0.7 | 360 | 9/3/2021 |
2.0.6 | 330 | 9/3/2021 |
2.0.5 | 328 | 9/3/2021 |
2.0.4 | 345 | 8/30/2021 |
2.0.3 | 339 | 8/27/2021 |
2.0.2 | 338 | 8/24/2021 |
2.0.1 | 320 | 8/24/2021 |
2.0.0 | 346 | 4/29/2021 |
1.0.3 | 380 | 2/28/2021 |
1.0.2 | 964 | 1/24/2021 |
1.0.1 | 383 | 1/24/2021 |
1.0.0 | 1,105 | 12/16/2020 |