Category: .NET

  • OpenSource library–Strong naming

    The strong naming is something that I have not have done usually,so it will be interesting following https://docs.microsoft.com/en-us/dotnet/standard/library-guidance/strong-naming . Nr Recomandation AOP Roslyn 1 CONSIDER strong naming your library’s assemblies. Not –see below 2 CONSIDER adding the strong naming key to your source control system. easy- not 3 CONSIDER incrementing the assembly version on only…

  • My Async Await tutorials

    Rule of thumb: just await / async from top to down.   To deeply understand async await in .NET Core,please follow the following resources:   1. https://channel9.msdn.com/Events/TechDays/Techdays-2014-the-Netherlands/Async-programming-deep-dive  – to gain inner knowledge about what code is async / await 2. Read https://blog.stephencleary.com/2012/02/async-and-await.html to have started into async await 3. Read MSDN for a better understanding…

  • Connections strings to config

    I have the opportunity to work on some pretty old code . There were many projects,all that had a sort of connection string to the database.  This kind of code were in like > 11 places : string connectionstring = “Data Source=.\\SqlServer;Initial Catalog=myDB;Integrated Security=SSPI;”; The task was to modify this in something that could read…

  • Circular references on .NET,Entity Framework and WebAPI

    Imagine having a class Department( ID,Name) and Employee ( ID,Name,IDDepartment) . You want to return in the WebAPI the Departments with the Employee . It is simple to wrote this code: But the problem is with circular references when serializing  : The Department has a list of  Employees  that have a Department that have a…

  • Interpreter–part 7 of n–thank you

    In our days you cannot build a project without help from other projects.  So it is your project – it is build on the shoulder of others( https://en.wikipedia.org/wiki/Standing_on_the_shoulders_of_giants ) Add a third party notice and thanks others that contributes with components to your project. I have discovered https://github.com/KrystianKolad/DotnetThx  – and running it gives me that…

  • Obtain data from ANAF(local IRS)

    In ROmania ANAF is providing a WebAPI that allows access to some of the information that any enterprise should provide. The API is described at https://webservicesp.anaf.ro/PlatitorTvaRest/api/v3/, I have made a C# console and a node,js script. The differences: 1.it is easiear in node to make an http request. 2. For C# – I think in…

  • Tiny Types–documentation–part 4

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ tiny types in C# Tiny types is a NuGET dll,https://www.nuget.org/packages/TinyTypesObjects/ Also,you can find the construction here: http://msprogrammer.serviciipeweb.ro/category/tinytypes/ The documentation is copied shameless from https://github.com/jan-molak/tiny-types Installation To install the module from nuget : … Install-Package TinyTypesObjects … Defining Tiny Types An int on its own is just a…

  • TinyTypes–adding equality operator–part 3

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ Now we have come to the interesting part – the equality operator. We have already operator equals,but not == Because we primary want this TinyTypes for structs( int,double,bool,and so on) we can define a new class For this we could implement operator  ==  by using the Equals…

  • Tiny Types part 2–adding IEquatable

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ As always,the bigger problem is adding equality. The Tiny Type should be equal with the inner value – and with the other type with the same value. And,in C#,when you implement equality,there is a whole theory – see https://msdn.microsoft.com/en-us/library/336aedhh(v=vs.100).aspx . So the code to define equality is…

  • Tiny types in C#–part 1

    This is a series http://msprogrammer.serviciipeweb.ro/2018/03/12/tiny-types-in-cpart-1/ http://msprogrammer.serviciipeweb.ro/2018/03/19/tiny-types-part-2adding-iequatable/ http://msprogrammer.serviciipeweb.ro/2018/03/26/tinytypesadding-equality-operatorpart-3/ http://msprogrammer.serviciipeweb.ro/2018/04/02/tiny-typesdocumentationpart-4/ I have read about tiny types in Javascript  – at https://darrenhobbs.com/2007/04/11/tiny-types/ and at https://janmolak.com/tiny-types-in-typescript-4680177f026e . It was an interesting idea – especially in this world of REST API . I decided to make the same on C# – so here it is: https://github.com/ignatandrei/tinyTypes and at https://www.nuget.org/packages/TinyTypesObjects .…