Skip to content

Instantly share code, notes, and snippets.

View Yearmix's full-sized avatar
💭
hosted with ❤ by GitHub

Alexey Pokrowskiy Yearmix

💭
hosted with ❤ by GitHub
  • USA
View GitHub Profile
@Yearmix
Yearmix / Program.cs
Created February 18, 2022 11:45 — forked from DanielSWolf/Program.cs
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@Yearmix
Yearmix / findDuplicatesInStringRow.sql
Last active February 26, 2020 11:36
find duplicates in string row
declare @testdata TABLE
(
id int,
string nvarchar(max)
)
insert @testdata select 1, 'test test blah'
insert @testdata select 2, 'east west'
insert @testdata select 3, 'no way'
insert @testdata select 4, ''
@Yearmix
Yearmix / context.cs
Created October 18, 2019 11:13
EF CF entity splitting
public partial class Employee
{
// These fields come from the “Employee” table
public int EmployeeId { get; set; }
public string Code { get; set; }
public string Name { get; set; }
// These fields come from the “EmployeeDetails” table
public string PhoneNumber { get; set; }
public string EmailAddress { get; set; }
@Yearmix
Yearmix / map.sql
Last active December 14, 2019 11:19
Make CF models for EF from SQL table
use [table_name]
declare @table TABLE(SQL_Server_data_type nvarchar(50) null, CLR_data_type_SQL_Server nvarchar(50) null, CLR_data_type_NET_Framework nvarchar(50) null)
insert into @table(SQL_Server_data_type, CLR_data_type_SQL_Server, CLR_data_type_NET_Framework) values
('varbinary','SqlBytes, SqlBinary','byte[]'),
('binary','SqlBytes, SqlBinary','byte[]'),
('varbinary(1), binary(1)',' SqlBytes, SqlBinary','byte, byte[]'),
('image',null,'byte[]'),
('varchar',null,'string'),