Skip to content

Instantly share code, notes, and snippets.

View merken's full-sized avatar

Maarten Merken merken

View GitHub Profile
@merken
merken / TenantInfo.cs
Created September 25, 2019 11:33
TenantInfo
namespace efcore_tenancy.Infrastructure
{
public class TenantInfo
{
public string Name { get; set; }
}
}
@merken
merken / DiscriminatorColumnInterceptor.cs
Last active September 25, 2019 11:31
DiscriminatorColumnInterceptor
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.Extensions.DependencyInjection;
namespace efcore_tenancy.Infrastructure
{
public class DiscriminatorColumnInterceptor : DbCommandInterceptor
@merken
merken / SchemaInterceptor.cs
Last active January 20, 2022 16:43
SchemaInterceptor
using System.Data.Common;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Diagnostics;
namespace efcore_tenancy.Infrastructure
{
public class SchemaInterceptor : DbCommandInterceptor
{
private readonly TenantInfo tenantInfo;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection;
namespace auth.api
{
public static class MvcExtensions
{
public static IMvcBuilder AddControllersFromRouteBranch(this IMvcBuilder builder, Assembly Assembly, string route)
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using auth.api.Services;
using auth.api.Security;
using auth.api.Security.MyDb;
using Microsoft.AspNetCore.Http;
using WebApiContrib.Core;
using System.Linq;
using System.Reflection;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
namespace auth.api
{
public class RouteBranchControllerFeatureProvider : ControllerFeatureProvider
{
private readonly string route;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using auth.api.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace auth.api.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using auth.api.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace auth.api.Controllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using auth.api.Security;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace auth.api.Controllers
{
namespace auth.api
{
[System.AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
sealed class RouteBranchAttribute : System.Attribute
{
// See the attribute guidelines at
// http://go.microsoft.com/fwlink/?LinkId=85236
readonly string route;
// This is a positional argument