forked from beyond-code-github/LinqToQuerystring
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathConfiguration.cs
More file actions
41 lines (33 loc) · 1.3 KB
/
Configuration.cs
File metadata and controls
41 lines (33 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
namespace LinqToQuerystring
{
using System;
using System.Collections.Generic;
using LinqToQuerystring.Utils;
public static class Configuration
{
public static Func<Type, Type> DefaultTypeMap = (type) => type;
public static Func<Type, Type, Type> DefaultTypeConversionMap = (from, to) => to;
/// <summary>
/// Exstensibility point for specifying an alternate type mapping when casting to IEnumerable
/// </summary>
public static Func<Type, Type> EnumerableTypeMap { get; set; }
/// <summary>
/// Exstensibility point for specifying an alternate type mapping when casting values
/// </summary>
public static Func<Type, Type, Type> TypeConversionMap { get; set; }
/// <summary>
/// Allows the specification of custom tree nodes for particular situations, i.e Entity Framework include
/// </summary>
public static Dictionary<string, CustomNodeMappings> CustomNodes { get; set; }
public static void Reset()
{
EnumerableTypeMap = DefaultTypeMap;
TypeConversionMap = DefaultTypeConversionMap;
CustomNodes = new Dictionary<string, CustomNodeMappings>();
}
static Configuration()
{
Reset();
}
}
}