Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Linq;
using System.Collections.Generic;
using SQLite;
namespace GuideStar.Data
{
public class Act : BaseEntity
{
[Indexed]
using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using log4net;
using System.Reflection;
using System.Configuration;
namespace Ideal.Web
{
public class InviteList_Hydrated : AbstractIndexCreationTask<InviteList>
{
public InviteList_Hydrated()
{
Map = docs => from doc in docs select new { doc.Name, doc.Site.Id };
TransformResults = (db, docs) => from doc in docs
let Households = (
from hh in doc.Households
let household = db.Load<Archant.Wedding.Areas.AddressBook.Models.Household>(hh.Id)
@wayne-o
wayne-o / NodaZoneDateTimeConverter.cs
Created March 17, 2012 20:05
NodaZoneDateTimeConverter
using System;
using System.Globalization;
using Newtonsoft.Json;
namespace NodaTime.Serialization.JsonNet
{
public class NodaZoneDateTimeConverter : JsonConverter
{
public NodaZoneDateTimeConverter()
{
@wayne-o
wayne-o / NodaOffsetConverter
Created March 17, 2012 20:06
NodaOffsetConverter
using Newtonsoft.Json;
using NodaTime.ZoneInfoCompiler;
namespace NodaTime.Serialization.JsonNet
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@wayne-o
wayne-o / ZonedDateTimeTests
Created March 17, 2012 20:07
ZonedDateTimeTests
using System;
using Newtonsoft.Json;
using NUnit.Framework;
using NodaTime.Serialization.JsonNet;
namespace NodaTime.Serialization.Test.JsonNet
{
[TestFixture]
public class ZonedDateTimeTests
{
@wayne-o
wayne-o / OffsetTests.cs
Created March 17, 2012 20:08
OffsetTests
using System;
using Newtonsoft.Json;
using NUnit.Framework;
using NodaTime.Serialization.JsonNet;
namespace NodaTime.Serialization.Test.JsonNet
{
[TestFixture]
public class OffsetTests
{
@wayne-o
wayne-o / NodaZoneDateTimeConverter.cs
Created March 17, 2012 20:24
NodaZoneDateTimeConverter updated
using System;
using System.Globalization;
using Newtonsoft.Json;
namespace NodaTime.Serialization.JsonNet
{
public class NodaZoneDateTimeConverter : JsonConverter
{
public NodaZoneDateTimeConverter()
{
@wayne-o
wayne-o / NodaZoneDateTimeConverter.cs
Created March 17, 2012 20:49
NodaZoneDateTimeConverter
using System;
using System.Globalization;
using Newtonsoft.Json;
namespace NodaTime.Serialization.JsonNet
{
public class NodaZoneDateTimeConverter : JsonConverter
{
public NodaZoneDateTimeConverter()
{
@wayne-o
wayne-o / CORS
Created March 19, 2012 08:42
CORS
private Stream ReturnAsStream<T>(T toSerialize)
{
var settings = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
var json = JsonConvert.SerializeObject(toSerialize, Formatting, settings);
WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8";
return new MemoryStream(System.Text.Encoding.UTF8.GetBytes(json));
}