2021/10/18

2021/09/09

Custom immutable class MoneyAmmount using class Immutable

Warrning: If u want to publish in your class some collection property u should use Immutable.Clone() method to prevent from casting fg ReadOnlyCollection to List by client and change real published collection objects states

2021/06/30

2021/04/22

How to get procedure name from sql script using regular expressions ?

Plain text:

public class ProcedureNameProvider : SqlObjectNameProvider { protected override string RegExPattern => @"((?!PROCEDURE).)*[\s]+PROCEDURE(\s*)(?[^\s]+)[\s]+"; public override string GetNameFromSqlScript(string sqlObjectDefinition) { Match match = new Regex(RegExPattern, RegexOptions.IgnoreCase).Match(sqlObjectDefinition); return match.Success ? NormalizeBrackets(match.Groups["proc_name"].Value) : String.Empty; } }

How to find sql procedure definition in script file using Regular expressions ?

2021/04/01

How to create xUnit test project in .NET Core ?

1/ Add new ClassLibrary project in .Net Core in your solution

2/ Add references to nuget libs
Fg this version

Microsoft.NET.Test.Sdk
xunit
xunit.runner.visualstudio

3/ Create simple test

4/ Run test

2020/05/02

How to create and connect with mysql client to mysql server running on docker container ?

1/ Download Docker form WIndows
https://docs.docker.com/toolbox/toolbox_install_windows/

2/Download mysql image and run mysql container
docker container run -it --detach --name mysql-server -p 3306:3306 --env MYSQL_RANDOM_ROOT_PASSWORD=yes mysql:latest

3/Configure mysql
docker container logs mysql-server
find secret random password under"GENERATED ROOT PASSWORD"



Set up access users and passwords
Ensure that there is at least one user that has configured remote connection fg '%'

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MNBVCXZ987654321';
ALTER USER 'root'@'%' IDENTIFIED BY 'MNBVCXZ987654321';
FLUSH PRIVILEGES;

GRANT ALL PRIVILEGES ON *.* TO 'root'@'%';
UPDATE mysql.user SET Host='%' WHERE Host='127.0.0.1' AND User='root';

4/Connect to mysql using MySql client

host: 127.0.0.1
port: 3306
user: root
password: (known)



Do not forget to stop IIS or at least change ip for mysql service (docker bridge)