MMDHelpers.CSharp.Performance.Grpc
1.0.0
See the version list below for details.
dotnet add package MMDHelpers.CSharp.Performance.Grpc --version 1.0.0
NuGet\Install-Package MMDHelpers.CSharp.Performance.Grpc -Version 1.0.0
<PackageReference Include="MMDHelpers.CSharp.Performance.Grpc" Version="1.0.0" />
paket add MMDHelpers.CSharp.Performance.Grpc --version 1.0.0
#r "nuget: MMDHelpers.CSharp.Performance.Grpc, 1.0.0"
// Install MMDHelpers.CSharp.Performance.Grpc as a Cake Addin #addin nuget:?package=MMDHelpers.CSharp.Performance.Grpc&version=1.0.0 // Install MMDHelpers.CSharp.Performance.Grpc as a Cake Tool #tool nuget:?package=MMDHelpers.CSharp.Performance.Grpc&version=1.0.0
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. 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. |
.NET Core | netcoreapp3.1 is compatible. |
-
.NETCoreApp 3.1
- Google.Protobuf (>= 3.15.3)
- Grpc.AspNetCore (>= 2.35.0)
- MMDHelpers.CSharp.PerformanceChecks (>= 1.0.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.