Somaの式コメントでオリジナルの関数を使う(C#版)

上の補足。C#でほぼ同じものを書くとこうなります。F#のオプション型を意識していないのが主な違いです。

using System;
using System.Collections.Generic;
using Soma.Core;

namespace ConsoleApplication3
{
    public class Dialect : MsSqlDialect
    {
        public override IDictionary<string, Tuple<object, Type>> RootExprCtxt
        {
            get
            {
                Func<string, string> adjust = s => s ?? "UNKNOWN";
                var exprCtxt = new Dictionary<string, Tuple<object, Type>>(base.RootExprCtxt);
                exprCtxt["Adjust"] = Tuple.Create<object, Type>(adjust, adjust.GetType());
                return exprCtxt;
            }
        }
    }

    public class Config : MsSqlConfig
    {
        private readonly IDialect _dialect = new Dialect();

        public override string ConnectionString { get { return "Data Source=.;Initial Catalog=tempdb;Integrated Security=True"; } }

        public override IDialect Dialect { get { return _dialect; } }
    }

    public class Condition
    {
        public string Name { get; set; }

        public decimal Salary { get; set; }
    }

    internal class Program
    {
        private static void Main(string[] args)
        {
            var db = new Db(new Config());
            var employee = db.Query<dynamic>(@"select * from Employee where EmployeeName = /* Adjust c.Name */'test' and Salary > /* c.Salary */0", 
                new {c = new Condition {Name = (string) null, Salary = 1000M}});
            Console.ReadKey();
        }
    }
}