Skip to content

Instantly share code, notes, and snippets.

@Layoric
Layoric / main.cs
Last active September 1, 2016 02:31
Auto mapping
using System;
using ServiceStack;
using ServiceStack.Text;
public class GetPersonResponse
{
public string FirstName { get;set; }
public string LastName { get;set; }
public int Age { get;set; }
}
@Layoric
Layoric / main.cs
Last active August 25, 2016 03:31
Initializing your Redis connection.
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Redis;
var redisManagerPool = new RedisManagerPool("localhost:6379");
using(var client = redisManagerPool.GetClient())
{
client.Info.PrintDump();
@Layoric
Layoric / index.md
Last active August 25, 2016 03:30
Using ServiceStack.Redis on .NET Core
@Layoric
Layoric / main.cs
Created August 25, 2016 03:15
Initializing your Redis connection.
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class GithubRepository
{
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string Homepage { get; set; }
@Layoric
Layoric / main.cs
Created August 21, 2016 01:35
New Public Gist
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class GithubRepository
{
public string Name { get; set; }
public string Description { get; set; }
public string Url { get; set; }
public string Homepage { get; set; }
@Layoric
Layoric / AppHost.cs
Last active May 25, 2016 14:04
A very simple webhook integration with Slack and ServiceStack response filters
//Example use AppHost
public class AppHost : AppHostBase
{
public AppHost()
: base("SlackPluginExample", typeof(MyServices).Assembly) { }
public override void Configure(Container container)
{
this.Plugins.Add(new SlackNotifierFeature
{
@Layoric
Layoric / pom.xml
Created April 18, 2016 03:11
Apache Felix basic POM config
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the
NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF
licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing
Assembly assembly = Assembly.LoadFile("...Assembly1.dll");
Type type = assembly.GetType("TestAssembly.Main");
if (type != null)
{
MethodInfo methodInfo = type.GetMethod(methodName);
if (methodInfo != null)
{
object result = null;
ParameterInfo[] parameters = methodInfo.GetParameters();
object classInstance = Activator.CreateInstance(type, null);
@Layoric
Layoric / ApplicationDirectory
Created July 25, 2013 01:10
Get file system directory of where the current executable is running from
string assemblyDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().Location);
@Layoric
Layoric / HelloWorld.cs
Created December 5, 2015 04:05
ServiceStack Model routes example
[Route("/hello/{Name}")]
public class Hello : IReturn<HelloResponse>
{
public string Name { get; set; }
}
public class HelloResponse
{
public string Result { get; set; }
}