This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); // view generated SQL | |
OrmLiteConfig.StripUpperInLike = true; // comment to force insensitive like comparisons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var base64Key = System.Convert.ToBase64String(ServiceStack.AesUtils.CreateKey()); | |
System.Console.WriteLine(base64Key); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.Redis; | |
using ServiceStack.DataAnnotations; | |
using ServiceStack.Caching; | |
var redisManager = new RedisManagerPool("localhost:6379"); | |
var redis = redisManager.GetClient(); | |
redis.FlushAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.Redis; | |
using ServiceStack.DataAnnotations; | |
var redisManager = new RedisManagerPool("localhost:6379"); | |
var redis = redisManager.GetClient(); | |
redis.FlushAll(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Linq; | |
using ServiceStack; | |
using ServiceStack.Text; | |
JsConfig<Guid>.SerializeFn = guid => guid.ToString(); | |
public partial class Dto | |
{ | |
public Guid Guid { get; set; } = Guid.NewGuid(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using ServiceStack; | |
using ServiceStack.Common; | |
using ServiceStack.Common.Extensions; | |
using ServiceStack.Common.Utils; | |
using ServiceStack.Redis; | |
using ServiceStack.Redis.Generic; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using ServiceStack; | |
using ServiceStack.Text; | |
using ServiceStack.OrmLite; | |
using ServiceStack.OrmLite.Sqlite; | |
using ServiceStack.DataAnnotations; | |
OrmLiteUtils.PrintSql(); | |
var dbFactory = new OrmLiteConnectionFactory(":memory:", SqliteDialect.Provider); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let taxOf salary taxRates = | |
((0m,0)::taxRates, taxRates) | |
||> Seq.zip | |
|> Seq.map(fun ((_, prevBand),(rate, band)) -> (prevBand, rate, band)) | |
|> Seq.sumBy(fun (prevBand, rate, band) -> | |
match salary with | |
| x when x < prevBand -> 0m | |
| x when x > band -> decimal(band - prevBand) * rate | |
| x -> decimal(x - prevBand) * rate | |
) |