This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
// Terrible property - this can be set to anything without reason | |
public string Username { get; set; } | |
// slightly better, but requires additional field | |
// and we still wouldn't know why "username2" changed | |
private string username2; | |
public string Username2 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Iban { | |
private readonly string plainIban; | |
private Iban(string iban) { | |
if (!Validate(iban)) throw new ArgumentException(); | |
plainIban = iban; | |
} | |
private bool Validate(string ibanToValidate) { | |
// validation (check length, validate check digits and sum, etc.) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reflection; | |
using System.Text.Json; | |
namespace DesignPatterns.DynamicStrategy { | |
class Program { | |
static void Main(string[] args) { | |
/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... imports | |
namespace Authentication.WebClient { | |
public class Startup { | |
private readonly IConfiguration configuration; | |
public Startup(IConfiguration configuration) { | |
this.configuration = configuration; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program { | |
static void Main(string[] args) { | |
using RSA rsa = RSA.Create(); | |
Console.WriteLine($"-----Private key-----{Environment.NewLine}{Convert.ToBase64String(rsa.ExportRSAPrivateKey())}{Environment.NewLine}"); | |
Console.WriteLine($"-----Public key-----{Environment.NewLine}{Convert.ToBase64String(rsa.ExportRSAPublicKey())}"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Jwt": { | |
"Symmetric": { | |
"Key": "" | |
}, | |
"Asymmetric": { | |
"PrivateKey": "", | |
"PublicKey": "MIIBCgKCAQEAsXoUruE3QybI3ygaARBUl0e663kxvylbSqlLBPf/lONUpWNucph5RQK/9WepNS/Z42Y79x+jf6MyPkgpMoLiiYB6Nzm5ssmZHg0ImzLmdyc3enCA0/TNrX8QBqieeLmm4Qja2pgsqtX7ae4En2Mr38qLrrpiMOXRqtxgVYqi+Lv9UxfVkRwHB4C+wc9FkM0IhmCja+AvpvtG7UBskPYLRB8o9gELVggKpV9t48yIEtJXG97BzmH3anEYZJY611NylZ1VUbnFbmRGJjAqF6Gy4bcGJbJrRlEQSGZT7mKKlxEijBR1VjADaQc8YVQXI76q1B3NiBcfvPSOJ+MSszd36QIDAQAB" | |
} | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... imports | |
namespace Authentication.WebClient { | |
public class Startup { | |
private readonly IConfiguration configuration; | |
public Startup(IConfiguration configuration) { | |
this.configuration = configuration; | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EFPractice.DataLayer.Interfaces; | |
using EFPractice.Domain; | |
using Microsoft.EntityFrameworkCore; | |
namespace EFPractice.DataLayer { | |
internal class ApplicationContext : DbContext, IDataStore { | |
public ApplicationContext(DbContextOptions options) : base(options) {} | |
public DbSet<Author> Authors { get; set; } | |
public DbSet<Book> Books { get; set; } |
NewerOlder