FrameIT
REST_JSON_API.TupleFactory Class Reference

Creates types that are much like anonymous types, via string-Type-pairs. More...

Classes

class  TupleFactoryImpl
 

Static Public Member Functions

static ITupleFactory Create (IEnumerable< KeyValuePair< string, Type > > properties)
 Gets a ITupleFactory singleton for a sequence of properties. More...
 
static NewExpression MakeNewExpression (IEnumerable< KeyValuePair< string, Expression > > properties)
 Gets a NewExpression for a tuple type with the specified properties. More...
 

Static Private Member Functions

static TupleFactory ()
 
static void EmitLdarg (ILGenerator il, int index)
 Helper function to pick the optimal op code. More...
 
static void EmitLdc (ILGenerator il, int i)
 Helper function to pick the optimal op code. More...
 

Static Private Attributes

static readonly ModuleBuilder _module = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName { Name = nameof(TupleFactory) }, AssemblyBuilderAccess.Run).DefineDynamicModule(nameof(TupleFactory), false)
 
static readonly Dictionary< ICollection< string >, Type > _genericTypeDefinitions = new Dictionary<ICollection<string>, Type>(CollectionComparer<string>.Default)
 
static readonly Dictionary< ICollection< KeyValuePair< string, Type > >, ITupleFactory_newExpressionFactories = new Dictionary<ICollection<KeyValuePair<string, Type>>, ITupleFactory>(new CollectionComparer<KeyValuePair<string, Type>>(KeyValueComparer<string, Type>.Default))
 
static readonly ConstructorInfo _objectCtor = typeof(object).GetConstructor(Type.EmptyTypes)
 
static readonly MethodInfo _objectEquals = typeof(object).GetMethod("Equals", BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(object) }, null)
 
static readonly MethodInfo _objectGetHashCode = typeof(object).GetMethod("GetHashCode", BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null)
 
static readonly MethodInfo _objectToString = typeof(object).GetMethod("ToString", BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null)
 
static readonly MethodInfo _stringFormat = typeof(string).GetMethod("Format", BindingFlags.Public | BindingFlags.Static, null, new[] { typeof(string), typeof(object[]) }, null)
 
static readonly MethodInfo _equalityComparerDefaultGetter
 
static readonly MethodInfo _equalityComparerEquals
 
static readonly MethodInfo _equalityComparerGetHashCode
 

Detailed Description

Creates types that are much like anonymous types, via string-Type-pairs.

Constructor & Destructor Documentation

◆ TupleFactory()

static REST_JSON_API.TupleFactory.TupleFactory ( )
staticprivate

Member Function Documentation

◆ Create()

static ITupleFactory REST_JSON_API.TupleFactory.Create ( IEnumerable< KeyValuePair< string, Type > >  properties)
static

Gets a ITupleFactory singleton for a sequence of properties.

Parameters
propertiesName/Type pairs for the properties.

◆ EmitLdarg()

static void REST_JSON_API.TupleFactory.EmitLdarg ( ILGenerator  il,
int  index 
)
staticprivate

Helper function to pick the optimal op code.

◆ EmitLdc()

static void REST_JSON_API.TupleFactory.EmitLdc ( ILGenerator  il,
int  i 
)
staticprivate

Helper function to pick the optimal op code.

◆ MakeNewExpression()

static NewExpression REST_JSON_API.TupleFactory.MakeNewExpression ( IEnumerable< KeyValuePair< string, Expression > >  properties)
static

Gets a NewExpression for a tuple type with the specified properties.

Member Data Documentation

◆ _equalityComparerDefaultGetter

readonly MethodInfo REST_JSON_API.TupleFactory._equalityComparerDefaultGetter
staticprivate

◆ _equalityComparerEquals

readonly MethodInfo REST_JSON_API.TupleFactory._equalityComparerEquals
staticprivate

◆ _equalityComparerGetHashCode

readonly MethodInfo REST_JSON_API.TupleFactory._equalityComparerGetHashCode
staticprivate

◆ _genericTypeDefinitions

readonly Dictionary<ICollection<string>, Type> REST_JSON_API.TupleFactory._genericTypeDefinitions = new Dictionary<ICollection<string>, Type>(CollectionComparer<string>.Default)
staticprivate

◆ _module

readonly ModuleBuilder REST_JSON_API.TupleFactory._module = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName { Name = nameof(TupleFactory) }, AssemblyBuilderAccess.Run).DefineDynamicModule(nameof(TupleFactory), false)
staticprivate

◆ _newExpressionFactories

readonly Dictionary<ICollection<KeyValuePair<string, Type> >, ITupleFactory> REST_JSON_API.TupleFactory._newExpressionFactories = new Dictionary<ICollection<KeyValuePair<string, Type>>, ITupleFactory>(new CollectionComparer<KeyValuePair<string, Type>>(KeyValueComparer<string, Type>.Default))
staticprivate

◆ _objectCtor

readonly ConstructorInfo REST_JSON_API.TupleFactory._objectCtor = typeof(object).GetConstructor(Type.EmptyTypes)
staticprivate

◆ _objectEquals

readonly MethodInfo REST_JSON_API.TupleFactory._objectEquals = typeof(object).GetMethod("Equals", BindingFlags.Public | BindingFlags.Instance, null, new[] { typeof(object) }, null)
staticprivate

◆ _objectGetHashCode

readonly MethodInfo REST_JSON_API.TupleFactory._objectGetHashCode = typeof(object).GetMethod("GetHashCode", BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null)
staticprivate

◆ _objectToString

readonly MethodInfo REST_JSON_API.TupleFactory._objectToString = typeof(object).GetMethod("ToString", BindingFlags.Public | BindingFlags.Instance, null, Type.EmptyTypes, null)
staticprivate

◆ _stringFormat

readonly MethodInfo REST_JSON_API.TupleFactory._stringFormat = typeof(string).GetMethod("Format", BindingFlags.Public | BindingFlags.Static, null, new[] { typeof(string), typeof(object[]) }, null)
staticprivate

The documentation for this class was generated from the following file: