Skip to content

Instantly share code, notes, and snippets.

@gistlyn
gistlyn / Configure.AuthRepository.cs
Last active February 14, 2024 08:46
Use MongoDB Auth Repository (requires auth)
using System;
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Configuration;
using ServiceStack.Authentication.MongoDb;
using MongoDB.Driver;
using ServiceStack.Web;
[assembly: HostingStartup(typeof(MyApp.ConfigureAuthRepository))]
@gistlyn
gistlyn / Configure.AuthRepository.cs
Last active November 11, 2021 15:40
Use Memory Auth Repository (requires auth)
using ServiceStack;
using ServiceStack.Web;
using ServiceStack.Auth;
using ServiceStack.Configuration;
[assembly: HostingStartup(typeof(MyApp.ConfigureAuthRepository))]
namespace MyApp
{
// Custom User Table with extended Metadata properties
@gistlyn
gistlyn / Configure.AuthRepository.cs
Last active February 14, 2024 08:46
Use Marten Auth Repository (requires auth)
using System;
using System.Collections.Generic;
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
using ServiceStack.Web;
using ServiceStack.Auth;
using ServiceStack.Configuration;
using Marten;
using ServiceStack.Authentication.Marten;
@gistlyn
gistlyn / Configure.AuthRepository.cs
Last active February 14, 2024 08:46
Use OrmLite Auth Repository (requires auth)
using ServiceStack;
using ServiceStack.Web;
using ServiceStack.Data;
using ServiceStack.Auth;
using ServiceStack.Configuration;
[assembly: HostingStartup(typeof(MyApp.ConfigureAuthRepository))]
namespace MyApp
{
@gistlyn
gistlyn / Configure.Auth.cs
Created November 11, 2021 15:04
Configure AuthFeature inc. .NET Core Providers
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.FluentValidation;
[assembly: HostingStartup(typeof(MyApp.ConfigureAuth))]
namespace MyApp
{
// Add any additional metadata properties you want to store in the Users Typed Session
@gistlyn
gistlyn / Configure.Auth.cs
Last active February 14, 2024 08:46
Configure AuthFeature
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.FluentValidation;
[assembly: HostingStartup(typeof(MyApp.ConfigureAuth))]
namespace MyApp
{
// Add any additional metadata properties you want to store in the Users Typed Session
@gistlyn
gistlyn / Configure.Db.Migrations.cs
Last active March 6, 2024 07:31
Use OrmLite with SQL Server
using MyApp.Migrations;
using ServiceStack;
using ServiceStack.Data;
using ServiceStack.OrmLite;
[assembly: HostingStartup(typeof(MyApp.ConfigureDbMigrations))]
namespace MyApp;
// Code-First DB Migrations: https://docs.servicestack.net/ormlite/db-migrations
@gistlyn
gistlyn / Configure.Db.Migrations.cs
Last active March 6, 2024 16:19
Use OrmLite with SQLite
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
using MyApp.Data;
using MyApp.Migrations;
using MyApp.ServiceModel;
using ServiceStack;
using ServiceStack.Data;
using ServiceStack.OrmLite;
[assembly: HostingStartup(typeof(MyApp.ConfigureDbMigrations))]
@gistlyn
gistlyn / Configure.Redis.cs
Last active August 18, 2022 08:03
Use ServiceStack.Redis
using ServiceStack;
using ServiceStack.Redis;
[assembly: HostingStartup(typeof(MyApp.ConfigureRedis))]
namespace MyApp;
public class ConfigureRedis : IHostingStartup
{
public void Configure(IWebHostBuilder builder) => builder
@gistlyn
gistlyn / Configure.RavenDb.cs
Last active January 31, 2022 00:24
Use RavenDB
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using ServiceStack;
using ServiceStack.DataAnnotations;
using Raven.Client.Documents;
[assembly: HostingStartup(typeof(MyApp.ConfigureRavenDb))]
namespace MyApp
{