Skip to content

Instantly share code, notes, and snippets.

@mythz

mythz/main.cs

Forked from gistlyn/main.cs
Created Mar 28, 2020
Embed
What would you like to do?
OrmLite runtime attributes
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);
var dbc = dbFactory.DialectProvider.GetStringConverter();
dbc.UseUnicode = true;
typeof(ServiceStack.Configuration.ConfigSetting)
.GetProperty("Id")
.AddAttributes(new ServiceStack.DataAnnotations.StringLengthAttribute(256));
using (var db = dbFactory.OpenDbConnection())
{
db.CreateTable<ServiceStack.Configuration.ConfigSetting>();
}
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="System.Memory" version="4.5.3" targetFramework="net45" />
<package id="ServiceStack.Text" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.Interfaces" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.Common" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.OrmLite.Sqlite.Windows" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.Redis" version="5.8.0" targetFramework="net45" />
<package id="ServiceStack.Server" version="5.8.0" targetFramework="net45" />
</packages>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment