Repository navigation
Expand file tree
/
Copy pathINodeMappingEngine.cs
More file actions
85 lines (76 loc) · 3.45 KB
/
Copy pathINodeMappingEngine.cs
File metadata and controls
85 lines (76 loc) · 3.45 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using System;
using umbraco.NodeFactory;
using System.Linq.Expressions;
using System.Reflection;
using System.Web.Caching;
namespace uComponents.Mapping
{
/// <summary>
/// Handles the creation of map and the mapping of Umbraco <c>Node</c>s to strongly typed
/// models.
/// </summary>
public interface INodeMappingEngine
{
/// <summary>
/// Creates a map to a strong type from an Umbraco document type
/// using the unqualified class name of <typeparamref name="TDestination"/>
/// as the document type alias.
/// </summary>
/// <typeparam name="TDestination">The type to map to.</typeparam>
/// <returns>Further mapping configuration</returns>
INodeMappingExpression<TDestination> CreateMap<TDestination>()
where TDestination : class, new();
/// <summary>
/// Creates a map to a strong type from an Umbraco document type.
/// </summary>
/// <typeparam name="TDestination">The type to map to.</typeparam>
/// <param name="documentTypeAlias">The document type alias to map from.</param>
/// <returns>Further mapping configuration</returns>
INodeMappingExpression<TDestination> CreateMap<TDestination>(string documentTypeAlias)
where TDestination : class, new();
/// <summary>
/// True if the engine is in possession of an <see cref="ICacheProvider"/>.
/// </summary>
bool IsCachingEnabled { get; }
/// <summary>
/// Sets the cache provider for the engine to use. This will clear any existing
/// cache provider. Set as null to disable caching.
///
/// You probably want to use an instance of <see cref="uComponents.Mapping.DefaultCacheProvider"/>.
/// </summary>
void SetCacheProvider(ICacheProvider cacheProvider);
/// <summary>
/// Gets an Umbraco <c>Node</c> as a <typeparamref name="TDestination"/>, only including
/// specified relationship paths.
/// </summary>
/// <typeparam name="TDestination">
/// The type of object that <paramref name="sourceNode"/> maps to.
/// </typeparam>
/// <param name="sourceNode">The <c>Node</c> to map from.</param>
/// <param name="paths">The relationship paths to include.</param>
/// <returns><c>null</c> if the node does not exist.</returns>
TDestination Map<TDestination>(Node sourceNode, params string[] paths)
where TDestination : class, new();
/// <summary>
/// Gets a query for nodes which map to <typeparamref name="TDestination"/>.
/// </summary>
/// <typeparam name="TDestination">The type to map to.</typeparam>
/// <returns>A fluent configuration for the query.</returns>
INodeQuery<TDestination> Query<TDestination>()
where TDestination : class, new();
#region Legacy
/// <summary>
/// Obsolete mapping method.
/// </summary>
[Obsolete("Use paths instead")]
TDestination Map<TDestination>(Node sourceNode, bool includeRelationships)
where TDestination : class, new();
/// <summary>
/// Obsolete mapping method.
/// </summary>
[Obsolete("Use paths instead")]
TDestination Map<TDestination>(Node sourceNode, params Expression<Func<TDestination, object>>[] includedRelationships)
where TDestination : class, new();
#endregion
}
}