erl -sname somename
erl -setcookie foo -sname somename
// This was the idea. Unfortunately, it doesn't work. The expression expects every successive item to be | |
// the same type the first expression, ProvidedProperty. I can upcast them all to MemberInfo, but then they | |
// don't work as arguments to the next items in the expression. | |
let createType name (parameters:obj[]) = | |
let providedAsmPath = Path.Combine(config.TemporaryFolder, "FixedLengthTypes.dll") | |
let providedAsm = ProvidedAssembly(providedAsmPath) | |
let length = parameters.[0] :?> int | |
let ty = ProvidedTypeDefinition(asm, "FixedLengthTypes", name, Some typeof<obj>, IsErased = false) | |
ty.AddMembers(list { | |
yield ProvidedProperty("Length", typeof<int>, IsStatic = true, |
// Computation expression builder that uses a custom bind operation | |
// to allow binding a value to a name and yielding it as part of a | |
// list in one go. | |
type ListBuilder() = | |
member this.Bind(x, f) = x::f(x) | |
member this.Delay(f) = f() | |
member this.Combine(x, xs) = x @ xs | |
member this.Yield(x) = [x] | |
let list = ListBuilder() |
// I'm using lots of operating overloading voodoo to avoid | |
// having to specify static type constraints manually. | |
// I'm also using MemoryStream / BinaryReader which is probably | |
// slow but it was the easiest way to read values sequentially. | |
// It's currently just using the size of the receiving datatype | |
// rather than specifying it, though that could change. | |
open System | |
open System.IO | |
let (|Value|_|) value item = | |
if item = value | |
then Some() | |
else None | |
let x = 1 | |
match [1] with | |
| [Value x] -> "match" | |
| _ -> "no match" |
/// <summary> | |
/// Compare two expressions so that methods taking lambda | |
/// expressions as arguments can be mocked with NSubstitute. | |
/// <example> | |
/// _ordersRepository.Find(Expr.Is<Order>(o => o.Id == 2)).Returns(order2) | |
/// </example> | |
/// </summary> | |
public static class Expr | |
{ | |
public static Expression<Func<TArg, bool>> Is<TArg>(Expression<Func<TArg, bool>> expression) |
using AutoMapper; | |
using System; | |
using System.Linq; | |
using System.Linq.Expressions; | |
namespace MappingTest | |
{ | |
class Cat | |
{ | |
public string Name { get; set; } |
<?xml version="1.0" encoding="utf-8"?> | |
<Edmx Version="3.0" xmlns="http://schemas.microsoft.com/ado/2009/11/edmx"> | |
<Runtime> | |
<ConceptualModels> | |
<Schema Namespace="Test" Alias="Self" p4:UseStrongSpatialTypes="false" xmlns:p4="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm"> | |
<EntityType Name="Contact"> | |
<Key> | |
<PropertyRef Name="Id" /> | |
</Key> | |
<Property Name="Id" Type="Int32" Nullable="false" p4:StoreGeneratedPattern="Identity" /> |