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
public class LinqQuery<T> | |
{ | |
Action<Action<T>> _source; | |
public LinqQuery(Action<Action<T>> source) | |
{ | |
_source = source; | |
} | |
public LinqQuery(T[] array) |
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
interface IProductService | |
{ | |
Future<int> GetPrice(string id); | |
Future<double> GetDiscount (int qty); | |
} | |
Future<int> GetQuote(string id, int qty) | |
{ | |
var service = _activator.Get<IProductService>(); |
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
.On<QuoteRequest, QuoteRequest>(m => m) | |
.Request<int>( | |
state => new PriceRequest | |
{ | |
Id = state.Id | |
}) | |
.Request<double>( | |
state => new DiscountRequest | |
{ | |
Qty = state.Qty |
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
[Authenticated] | |
public class SomePage | |
{ | |
[Inject("CurrentUser")] | |
public User CurrentUser { 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
interface INumber = | |
(+) (x : INumber) : INumber | |
(-) (y : INumber) : INumber | |
(*) (x : INumber) : INumber | |
(++) : INumber | |
(--) : INumber |
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
public IPipeline<TResult,TState> Combine<T1,T2,T3,TResult>( | |
IPipeline<T1,TState> a, | |
IPipeline<T2,TState> b, | |
IPipeline<T3,TState> c, | |
IPipeline<TResult,TState> d) | |
{ | |
return a.Then(b).Then(c).Then(d); | |
} | |
public IPipeline<TResult, TState> Combine<T1, T2, TResult>( |
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
open System | |
open System.Linq | |
open System.Collections.Generic | |
open System.Collections.Concurrent | |
open Microsoft.FSharp.Collections | |
open System.Reflection | |
type Container() = | |
let _map = new HashMultiMap<Type,Type>(HashIdentity.Structural) | |
let _activated = new ConcurrentDictionary<Type, obj>() |
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
public Slice Get(Slice key, int transactionId = -1) | |
{ | |
var record = UseTransaction (transactionId, tr=>tr.Records.FindLast (r=> r.Key == key)); | |
if (record != null) return record.Value; | |
var r = log.Get(key); | |
if (v != null) return v; | |
return InternalGet(key); | |
} |
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
ITemplate Compile(string assemblyPath, string templateId, string input, List<string> usings) | |
{ | |
var providerOptions = new Dictionary<string, string>(); | |
providerOptions.Add("CompilerVersion", "v4.0"); | |
ITemplate _template = null; | |
var usingBuilder = new StringBuilder(); | |
foreach (var @using in _usings) | |
{ |
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
ITemplate Compile (string path, string id, string input, List<string> usings) | |
<- assembly.CreateInstance (typeName) | |
typeName = "Templates_Template_{0}_{1}".FormatWith (id, DateTime.Now.Ticks) | |
assembly = results.CompiledAssembly | |
results = provider.CompileAssemblyFromSource (options, code) | |
provider = new CSharpProvider | |
<- new Dictionary<string, string> | |
<- {"CompilerVersion", "v4.0"} |