|
1 | | -usingSystem; |
2 | | -usingSystem.Collections.Generic; |
| 1 | +namespaceReduxSimple.Entity; |
3 | 2 |
|
4 | | -namespaceReduxSimple.Entity |
| 3 | +/// <summary> |
| 4 | +/// Adapter of an <see cref="EntityState{TKey, TEntity}"/> with the different reducer functions to handle entity manipulation. |
| 5 | +/// </summary> |
| 6 | +/// <typeparam name="TKey">Primary key of the entity.</typeparam> |
| 7 | +/// <typeparam name="TEntity">Type of the entity.</typeparam> |
| 8 | +publicsealedclassEntityAdapter<TKey,TEntity>:EntityStateAdapter<TKey,TEntity> |
| 9 | +whereTEntity:class |
5 | 10 | { |
| 11 | +privateEntityAdapter() |
| 12 | +{ |
| 13 | +} |
| 14 | + |
6 | 15 | /// <summary> |
7 | | -///Adapter of an<see cref="EntityState{TKey, TEntity}"/> with the different reducer functions to handle entity manipulation. |
| 16 | +///Get selectors for the specified<see cref="EntityState{TKey, TEntity}"/>. |
8 | 17 | /// </summary> |
9 | | -/// <typeparam name="TKey">Primary key of the entity.</typeparam> |
10 | | -/// <typeparam name="TEntity">Type of the entity.</typeparam> |
11 | | -publicsealedclassEntityAdapter<TKey,TEntity>:EntityStateAdapter<TKey,TEntity> |
12 | | -whereTEntity:class |
| 18 | +/// <returns>A new Entity Selectors.</returns> |
| 19 | +publicEntitySelectors<TKey,TEntity>GetSelectors() |
13 | 20 | { |
14 | | -privateEntityAdapter() |
15 | | -{ |
16 | | -} |
17 | | - |
18 | | -/// <summary> |
19 | | -/// Get selectors for the specified <see cref="EntityState{TKey, TEntity}"/>. |
20 | | -/// </summary> |
21 | | -/// <returns>A new Entity Selectors.</returns> |
22 | | -publicEntitySelectors<TKey,TEntity>GetSelectors() |
23 | | -{ |
24 | | -returnnewEntitySelectors<TKey,TEntity>(SortComparer); |
25 | | -} |
26 | | -/// <summary> |
27 | | -/// Get selectors for the specified <see cref="EntityState{TKey, TEntity}"/>. |
28 | | -/// </summary> |
29 | | -/// <typeparam name="TInput">Part of the state used to create selectors.</typeparam> |
30 | | -/// <param name="selectEntityState">Function used to select <see cref="EntityState{TKey, TEntity}"/> from the <typeparamref name="TInput"/>.</param> |
31 | | -/// <returns>A new Entity Selectors.</returns> |
32 | | -publicEntitySelectors<TInput,TKey,TEntity>GetSelectors<TInput>( |
33 | | -ISelectorWithoutProps<TInput,EntityState<TKey,TEntity>>selectEntityState |
34 | | -) |
35 | | -{ |
36 | | -returnnewEntitySelectors<TInput,TKey,TEntity>(selectEntityState,SortComparer); |
37 | | -} |
| 21 | +returnnewEntitySelectors<TKey,TEntity>(SortComparer); |
| 22 | +} |
| 23 | +/// <summary> |
| 24 | +/// Get selectors for the specified <see cref="EntityState{TKey, TEntity}"/>. |
| 25 | +/// </summary> |
| 26 | +/// <typeparam name="TInput">Part of the state used to create selectors.</typeparam> |
| 27 | +/// <param name="selectEntityState">Function used to select <see cref="EntityState{TKey, TEntity}"/> from the <typeparamref name="TInput"/>.</param> |
| 28 | +/// <returns>A new Entity Selectors.</returns> |
| 29 | +publicEntitySelectors<TInput,TKey,TEntity>GetSelectors<TInput>( |
| 30 | +ISelectorWithoutProps<TInput,EntityState<TKey,TEntity>>selectEntityState |
| 31 | +) |
| 32 | +{ |
| 33 | +returnnewEntitySelectors<TInput,TKey,TEntity>(selectEntityState,SortComparer); |
| 34 | +} |
38 | 35 |
|
39 | | -/// <summary> |
40 | | -/// Creates a new <see cref="EntityAdapter{TKey, TEntity}"/>. |
41 | | -/// </summary> |
42 | | -/// <param name="selectId">Function used to get the id of an entity.</param> |
43 | | -/// <param name="sortComparer">Comparer used to sort the collection of entities.</param> |
44 | | -/// <returns>A new Entity Adapter.</returns> |
45 | | -publicstaticEntityAdapter<TKey,TEntity>Create(Func<TEntity,TKey>selectId,IComparer<TEntity>sortComparer=null) |
| 36 | +/// <summary> |
| 37 | +/// Creates a new <see cref="EntityAdapter{TKey, TEntity}"/>. |
| 38 | +/// </summary> |
| 39 | +/// <param name="selectId">Function used to get the id of an entity.</param> |
| 40 | +/// <param name="sortComparer">Comparer used to sort the collection of entities.</param> |
| 41 | +/// <returns>A new Entity Adapter.</returns> |
| 42 | +publicstaticEntityAdapter<TKey,TEntity>Create(Func<TEntity,TKey>selectId,IComparer<TEntity>sortComparer=null) |
| 43 | +{ |
| 44 | +returnnewEntityAdapter<TKey,TEntity> |
46 | 45 | { |
47 | | -returnnewEntityAdapter<TKey,TEntity> |
48 | | -{ |
49 | | -SelectId=selectId, |
50 | | -SortComparer=sortComparer |
51 | | -}; |
52 | | -} |
| 46 | +SelectId=selectId, |
| 47 | +SortComparer=sortComparer |
| 48 | +}; |
53 | 49 | } |
54 | 50 | } |