Skip to content

Instantly share code, notes, and snippets.

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 / 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
@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 / 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 / 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 / index.md
Last active August 25, 2016 03:30
Using ServiceStack.Redis on .NET Core
@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 / 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 September 1, 2016 02:45
New Public Gist
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; }
public string PostCode { get;set; }
@Layoric
Layoric / index.md
Last active September 1, 2016 02:46
Auto mapping

Auto mapping

Auto mapping it a helpful utility in ServiceStack that allows you to easy populate different classes with the same structure allowing you to keep appropriate separations whilst reducing lines of code.

For example, it's common in ServiceStack to keep your request and response DTO classes separate from others like your OrmLite model classes or other logic classes even thought they might share the same structure.

public class GetPersonResponse
{
 public string FirstName { get;set; }