Skip to content

Instantly share code, notes, and snippets.

public ExampleDbContext(DbContextOptions options) : base(options)
{
}
public ExampleDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Person> Persons { get; set; }
using EFCoreSeparateProject.Core.Domain;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
namespace EFCoreSeparateProject.Infrastructure.EntityConfigurations
{
public class PersonConfiguration : IEntityTypeConfiguration<Person>
{
public void Configure(EntityTypeBuilder<Person> builder)
{
using EFCoreSeparateProject.Core.Domain;
using EFCoreSeparateProject.Infrastructure.EntityConfigurations;
using Microsoft.EntityFrameworkCore;
namespace EFCoreSeparateProject.Infrastructure
{
public class ExampleDbContext : DbContext
{
public ExampleDbContext(DbContextOptions options) : base(options)
{
{
"SqlConnectionString": "Server=127.0.0.1,5433;Database=EFCoreSeparateProjectDb;User Id=sa;Password=yourStrong(!)Password;"
}
using EFCoreSeparateProject.Infrastructure;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;
using Microsoft.Extensions.Configuration;
using System.IO;
namespace EFCoreSeparateProject.Migrations
{
public class ExampleDbContextFactory : IDesignTimeDbContextFactory<ExampleDbContext>
{
{
"ConnectionStrings": {
"DbUpSqlConnectionString": "Server=127.0.0.1,1589;Database=sqldb-databasereleaseautomation;User Id=sa;Password=YourPassword123;"
}
}
@joewashington75
joewashington75 / Program.cs
Created May 26, 2020 20:25
DbUp Program.cs
using DbUp;
using Microsoft.Extensions.Configuration;
using System;
using System.Linq;
using System.Reflection;
namespace DatabaseReleaseAutomation.DbUpDemo
{
class Program
{
@joewashington75
joewashington75 / SeleniumAzureAdAuth.cs
Created February 22, 2022 13:21
Basic Authentication using Selenium
public static IWebDriver AzureAdRedirectWithAuthDetails(this IWebDriver driver, string userName, string password, string domainToReplace)
{
Thread.Sleep(TimeSpan.FromSeconds(5));
var newUrlWithUserCredentials = driver.Url.Replace(domainToReplace, $"{WebUtility.HtmlEncode(userName)}:{password}@{domainToReplace}");
driver.Navigate().GoToUrl(newUrlWithUserCredentials);
return driver;
}
@joewashington75
joewashington75 / PlaywrightAzureAdBasicAuth.cs
Created February 22, 2022 13:44
Basic Authentication automation using Playwright
using Cocona;
using Microsoft.Playwright;
using PlaywightAzureAdBasicAuth;
var builder = CoconaApp.CreateBuilder();
var app = builder.Build();
app.AddCommand(async ([Argument(Description = "Username to login with")] string userName,
[Argument(Description = "Password to login with")] string password,
[Argument(Description = "The url of your application as a starting point where your login button is located")] string applicationUrl,