Skip to content

Instantly share code, notes, and snippets.

Avatar

Demis Bellot mythz

View GitHub Profile
@mythz
mythz / main.cs
Created Jul 10, 2019 — forked from sashapodgoreanu/main.cs
Auto Mapping Converter Example
View main.cs
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 Jun 19, 2019
OrmLite 1:Many projection demo
View main.cs
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
OrmLite Self Reference Example
View main.cs
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 Apr 23, 2019
Test string DeSerilizeFn
View main.cs
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 Apr 8, 2019
SqlExpressionSelectFilter JoinAlias
View main.cs
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 Apr 7, 2019
CSV Serialize Test
View main.cs
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 Mar 30, 2019
Custom Self Reference Conventions
View main.cs
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 Feb 23, 2019
Minimal AMD define()
View ss-require.js
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 Oct 30, 2018
Rename inherited member in Sub class
View main.cs
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 Oct 18, 2018
test json deserialization
View main.cs
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>