Skip to content

Instantly share code, notes, and snippets.

View mythz's full-sized avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / main.cs
Created July 10, 2019 15:32 — forked from sashapodgoreanu/main.cs
Auto Mapping Converter Example
using System;
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
using System.Collections.Generic;
AutoMapping.RegisterConverter((CarRevisionDbo from) => {
var to = from.ConvertTo<CarRevisionDto>(skipConverters:true);
to.PopulateWith(from.Car);
return to;
@mythz
mythz / main.cs
Last active June 19, 2019 20:13
OrmLite 1:Many projection demo
using System;
using System.Collections.Generic;
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
@mythz
mythz / main.cs
Created May 7, 2019 20:05
OrmLite Self Reference Example
using System;
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
@mythz
mythz / main.cs
Created April 23, 2019 21:33
Test string DeSerilizeFn
using System.Linq;
using ServiceStack;
using ServiceStack.Text;
JsConfig<string>.DeSerializeFn = str => str?.Trim();
public class Test
{
public string Name { get; set; }
public string Age { get; set; }
@mythz
mythz / main.cs
Created April 8, 2019 06:58
SqlExpressionSelectFilter JoinAlias
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
OrmLiteUtils.PrintSql();
@mythz
mythz / main.cs
Created April 7, 2019 20:19
CSV Serialize Test
using System;
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
class ListEntry
{
public ListEntry(string a, string b)
{
@mythz
mythz / main.cs
Created March 30, 2019 00:48
Custom Self Reference Conventions
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 CustomerAddress
@mythz
mythz / ss-require.js
Created February 23, 2019 04:41
Minimal AMD define()
var EXPORT = { vue: 'Vue' };
window.define = function (name, deps, f) {
var anon = typeof name != "string";
if (anon) {
f = deps;
deps = name;
}
if (typeof deps == "function") {
f = deps;
deps = [];
@mythz
mythz / main.cs
Created October 30, 2018 12:10
Rename inherited member in Sub class
using System.Linq;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.Text;
[DataContract]
public class Parent
{
[DataMember(Name = "parentItem")]
public virtual string Item { get; set; }
@mythz
mythz / main.cs
Last active October 18, 2018 12:39
test json deserialization
using System;
using System.Linq;
using System.Collections.Generic;
using ServiceStack;
using ServiceStack.Text;
var json = "{\"Confirmations\":[{\"ChangeId\":126552616,\"Confirmed\":true}]}";
[Route("/confirmations", "PUT")]
public class PutConfirmed : IReturn<PutConfirmedResponse>