I will write down the useful method. I used it several times and it works good. It's C# method to create a UNC directory recursively and return the path.
(read more...)I will write down the useful method. I used it several times and it works good. It's C# method to create a UNC directory recursively and return the path.
(read more...)If you want to write an application which uses RabbitMQ, I advise you to use docker image of Rabbit. It's lightweight and can be easily executed.
(read more...)Create a console app with .Net Framework 4.7.2 with Dapper and datasource in MSSQL Server or PostgreSQL.
If you create this ancient app, you should only add Dapper and NPGSQL packages from Nuget. The support of MS SQL Server is already built in. The scenario for .Net Framework is from real life, several applications still require this framework.
(read more...)Once again I decided to make a new task from LeetCode and finally my process had been stopped. I could not convert Char to Int. I even spent some time for research, but I could not find any solution. Then I open the documentation and started to read.
(read more...)It's not for production, but for developer environments
Add the block below to Program.cs. I talk about Net Core 5 or Net Core 6 application.
// global cors policy
app.UseCors(x => x
.AllowAnyMethod()
.AllowAnyHeader()
.SetIsOriginAllowed(origin => true) // allow any origin
.AllowCredentials()); // allow credentials
I created an application which rendered a report in HTML. To improve it, I wanted it to open the rendered file in browser to simplify the viewing one. In the beginning I thought about using the CMD file, but I found a better solution.
(read more...)In my application I had rendered JSON data with AngularJS and I had to send it to a controller in my MVC application to render PDF file and to allow a user to save it. So, the task was dynamically to submit the request, render a file and allow user to save it.
(read more...)StreamWriter has some options of usage. You can as add new text to an existing text in file, so and to clean existing text and add a new one.
C# snippet below helps to read SQL data to List<T> generic collection without any extensions or frameworks only with SQL and LINQ.
Junior developer created some tools which packed to zip-archive some rendered files. He used for this DotNetZip (Ionic.Zip) library. Everything worked fine until today. But today, when users users tried to open zip-file, they've got the error "CRC has failed, the file is corrupt".
(read more...)