Skip to content

Instantly share code, notes, and snippets.

View mythz's full-sized avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / StringSegment.cs
Last active July 1, 2018 20:43
Removed StringSegmentExtensions.cs
#if !NETSTANDARD2_0
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace ServiceStack.Text
@mythz
mythz / main.cs
Created June 4, 2018 16:49
SelectMulti example
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
public class Customer
@mythz
mythz / main.cs
Last active April 5, 2018 19:13
Encode en-dash char test
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
class Dto
{
public string Text { get; set; }
}
var dto = new Dto { Text = "The – (en dash) character" };
@mythz
mythz / main.cs
Created January 23, 2018 12:32
OrmLite Dynamic Attribute Test
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
using ServiceStack.Logging;
LogManager.LogFactory = new ConsoleLogFactory(debugEnabled:true);
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
@mythz
mythz / main.cs
Last active December 17, 2017 11:59
OrmLite 1:1 Users and Roles
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.OrmLite;
using ServiceStack.OrmLite.Sqlite;
using ServiceStack.DataAnnotations;
using ServiceStack.Model;
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider);
var db = dbFactory.Open(); // Open ADO.NET DB Connection
@mythz
mythz / main.cs
Created December 10, 2017 19:34
JsonObject null response
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
public class CloudflareResponse
{
public JsonObject result { get; set; }
}
var json = "{\"result\":null}";
@mythz
mythz / main.cs
Created December 8, 2017 18:08
Templates List Dictionary Example
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
using ServiceStack.Templates;
var __Contacts = new List<Dictionary<string,object>> {
new Dictionary<string,object> {
{ "Title", "foo" },
},
@mythz
mythz / data.cs
Last active January 28, 2020 02:35
OrmLite Multiple Order By
using System.Collections.Generic;
using System.Data;
using ServiceStack;
using ServiceStack.OrmLite;
using ServiceStack.DataAnnotations;
public class Artist
{
public int Id { get; set; }
public string Name { get; set; }
@mythz
mythz / main.cs
Last active October 25, 2017 01:19
Test RedisAuthRepository
using System;
using ServiceStack;
using ServiceStack.Auth;
using ServiceStack.Text;
using ServiceStack.Redis;
using ServiceStack.Testing;
using ServiceStack.DataAnnotations;
IUserAuth fromRedis;
var redisManager = new RedisManagerPool("localhost:6379");
@mythz
mythz / main.cs
Last active July 15, 2017 16:24
Bloomberg API example
using System.Runtime.Serialization;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
// OpenFIGI API: https://www.openfigi.com/api
[DataContract]
public class Mapping
{