Skip to content

Instantly share code, notes, and snippets.

View andrewlock's full-sized avatar

Andrew Lock andrewlock

View GitHub Profile
@andrewlock
andrewlock / startup.cs
Last active August 4, 2016 17:11
Creating DbContext ConfigureServices
public void ConfigureServices(IServiceCollection services)
{
var connectionString = Configuration["ApplicationDbContext:ConnectionString"];
services.AddDbContext<ApplicationDbContext>(
opts => opts.UseNpgsql(connectionString)
);
services.Configure<MultitenancyOptions>(
options =>
{
@andrewlock
andrewlock / UserService.cs
Created September 14, 2016 08:47
Getting a Task when you don't expect it
public class UserService
{
private readonly IUserRepo _repo;
public UserService(IUserRepo repo)
{
_repo = repo;
}
public async Task<bool> DoesUserExist(int userId)