Skip to content

Commit 0e3b671

Browse files
authored
Docs improvements (#109)
* Fixing code samples to C# with VS2015 highlighting * Organising docs Adding custom styles
1 parent e73ab00 commit 0e3b671

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+239
-182
lines changed

docs/src/Collections.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@ The following collection types are supported by default:
1212
- `Collection<T>`
1313
- `HashSet<T>`
1414
- `ISet<T>`
15-
- [`Dictionary<string, T>`](Dictionary-Mapping)
16-
- [`IDictionary<string, T>`](Dictionary-Mapping)
15+
- [`Dictionary<string, T>`](/Dictionary-Mapping)
16+
- [`IDictionary<string, T>`](/Dictionary-Mapping)
1717

1818
Generic `List<T>` instances are created for interface-type members except `ISet<T>`, which uses a `HashSet<T>`. If a member is already populated with a non-readonly collection (e.g. an array), the existing object will be reused.
1919

20-
[Updates](Performing-Updates) and [merges](Performing-Merges) of collections of identifiable objects (i.e. Entities) are performed in an id-aware manner.
20+
[Updates](/Performing-Updates) and [merges](/Performing-Merges) of collections of identifiable objects (i.e. Entities) are performed in an id-aware manner.
2121

2222
## Null Source Collections
2323

docs/src/Configuration.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

docs/src/Configuring-Object-Identifiers.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

docs/src/Derived-Types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
For most cases, derived types are supported without configuration.
1+
For many cases, derived type mapping is supported without configuration.
22

33
For example, with the following classes:
44

@@ -50,4 +50,4 @@ var resultAnimals = Mapper.Map(sourceAnimals).ToANew<AnimalDto[]>();
5050
// resultAnimals[1] is of type DogDto
5151
```
5252

53-
In the second example above, the `Dog` -> `DogDto` and `Cat` -> `CatDto` types are paired by convention based on the names of the original `Animal` -> `AnimalDto` pairing. You can configure [type pairs](Pairing-Derived-Types) which don't have a consistent naming convention, and [in which assemblies](Assembly-Scanning) to look for derived types.
53+
In the second example above, the `Dog` -> `DogDto` and `Cat` -> `CatDto` types are paired by convention based on the names of the original `Animal` -> `AnimalDto` pairing. You can configure [type pairs](/configuration/Pairing-Derived-Types) which don't have a consistent naming convention, and [in which assemblies](/configuration/Assembly-Scanning) to look for derived types.

docs/src/Dictionary-Mapping.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
AgileMapper has extensive support for mapping to and from Dictionaries. Out of the box:
22

33
* Only dictionaries with string keys are supported
4-
* Dictionary keys must match target member names exactly, ignoring case ([configurable](Dictionary-Mapping-Configuration#configuring-keys))
5-
* Parent and child member names are matched to dictionary keys separated with a dot ([configurable](Dictionary-Mapping-Configuration#configuring-separators)), or flattened - with no separator
6-
* Enumerable elements are matched to dictionary keys by their index inside square brackets ([configurable](Dictionary-Mapping-Configuration#configuring-element-indexes))
4+
* Dictionary keys must match target member names exactly, ignoring case ([configurable](/configuration/Dictionary-Mapping#configuring-keys))
5+
* Parent and child member names are matched to dictionary keys separated with a dot ([configurable](/configuration/Dictionary-Mapping#configuring-separators)), or flattened - with no separator
6+
* Enumerable elements are matched to dictionary keys by their index inside square brackets ([configurable](/configuration/Dictionary-Mapping#configuring-element-indexes))
77
* Dictionaries can contain all or a mixture of value type values, collections and complex types - anything with a matching key is used
88
* Target members with no matching key in the dictionary are ignored
99

@@ -49,7 +49,7 @@ The created `contactDetails` will have the following property values:
4949
* "07890 654321" and
5050
* "01234 987654"
5151
* `Addresses` set to a new, 1-element `List<Address>` containing an `Address`:
52-
* With `HouseNumber` set to '123' ([parsed](Type-Conversion) from the string)
52+
* With `HouseNumber` set to '123' ([parsed](/Type-Conversion) from the string)
5353
* With `StreetName` set to "Dictionary Street"
5454

5555
Note that the `StreetName` key had no separator, but the mapping works anyway.
@@ -91,4 +91,4 @@ The created `Dictionary` will have the following keys and values:
9191

9292
## Configuration
9393

94-
Dictionary mapping is [highly configurable](Dictionary-Mapping-Configuration).
94+
Dictionary mapping is [highly configurable](/configuration/Dictionary-Mapping).

docs/src/Dynamic-Mapping.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
AgileMapper's [dictionary mapping](Dictionary-Mapping) also applies to [ExpandoObject](https://docs.microsoft.com/en-us/dotnet/api/system.dynamic.expandoobject?view=netframework-4.7.1)s, which are mapped using their `IDictionary<string, object>` interface.
1+
AgileMapper's [dictionary mapping](/Dictionary-Mapping) also applies to [ExpandoObject](https://docs.microsoft.com/en-us/dotnet/api/system.dynamic.expandoobject?view=netframework-4.7.1)s, which are mapped using their `IDictionary<string, object>` interface.
22

33
Out of the box:
44

5-
* Member names must match target member names exactly, ignoring case ([configurable](Dynamic-Mapping-Configuration#configuring-member-names))
6-
* Parent and child member names are matched to ExpandoObject member names separated with an underscore ([configurable](Dynamic-Mapping-Configuration#configuring-separators)), or flattened - with no separator
7-
* Enumerable elements are matched to ExpandoObject member names by their index separated by underscores ([configurable](Dynamic-Mapping-Configuration#configuring-element-indexes))
5+
* Member names must match target member names exactly, ignoring case ([configurable](/configuration/Dynamic-Mapping#configuring-member-names))
6+
* Parent and child member names are matched to ExpandoObject member names separated with an underscore ([configurable](/configuration/Dynamic-Mapping#configuring-separators)), or flattened - with no separator
7+
* Enumerable elements are matched to ExpandoObject member names by their index separated by underscores ([configurable](/configuration/Dynamic-Mapping#configuring-element-indexes))
88
* ExpandoObjects can contain all or a mixture of value type values, collections and complex types - anything with a matching member name is used
99
* Target members with no matching member in the ExpandoObject are ignored
1010

@@ -89,4 +89,4 @@ The created `ExpandoObject` (in both cases) will have the following member names
8989

9090
## Configuration
9191

92-
Dynamic mapping is [highly configurable](Dynamic-Mapping-Configuration).
92+
Dynamic mapping is [highly configurable](/configuration/Dynamic-Mapping).

docs/src/Entity-Mapping.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Mapping to entities - an object with a member decorated with a [`KeyAttribute`](
44

55
Members decorated with a `KeyAttribute` are not mapped, unless the mapping is a deep clone. Entity key values are usually generated by a data store, and some ORMs will throw an exception if a key value is updated in code.
66

7-
If you need to map to a `KeyAttribute` member, you can override this behaviour by configuring a [custom data source](Configuring-Member-Values).
7+
If you need to map to a `KeyAttribute` member, you can override this behaviour by configuring a [custom data source](/configuration/Member-Values).
88

99
### Optional Related Entity Keys
1010

docs/src/Enum-Mapping.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Flags enums are mapped automatically from numeric, string, enum and character so
99

1010
### Enum Mapping Mismatches
1111

12-
[Mapping plans](Using-Execution-Plans) warn you of enum mapping mismatches when mapping from one enum type to another. For example, a mapping between the following enums:
12+
[Mapping plans](/Using-Execution-Plans) warn you of enum mapping mismatches when mapping from one enum type to another. For example, a mapping between the following enums:
1313

1414
```cs
1515
// Source enum:
@@ -25,7 +25,7 @@ enum PaymentTypeUk { Cash, Card, Cheque }
2525
// - PaymentTypeUs.Check matches no PaymentTypeUk
2626
```
2727

28-
`PaymentTypeUk.Cheque` also mismatches, but the mapping is going from `PaymentTypeUs` -> `PaymentTypeUk`, and it only matters that all *source* values can be mapped to target values. This mismatch would cause an exception if you use [mapping validation](Validating-Mappings).
28+
`PaymentTypeUk.Cheque` also mismatches, but the mapping is going from `PaymentTypeUs` -> `PaymentTypeUk`, and it only matters that all *source* values can be mapped to target values. This mismatch would cause an exception if you use [mapping validation](/Validating-Mappings).
2929

3030
## Configuring Enum Pairs
3131

@@ -38,7 +38,7 @@ Mapper.WhenMapping
3838

3939
...which removes the enum mapping mismatch warning from the mapping plan, and stops the validation exception.
4040

41-
Enum pairing can also be configured [inline](Inline-Configuration):
41+
Enum pairing can also be configured [inline](/configuration/Inline):
4242

4343
```cs
4444
Mapper.Map(usTransaction).ToANew<UkTransaction>(cfg => cfg

docs/src/Mapping-Extension-Methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ customerDto.Map().OnTo(customer);
2222

2323
### Using an Instance-Scoped Mapper
2424

25-
Mappings performed via these extension methods use the default mapper - the same one you map with via the [static Mapper API](Static-vs-Instance-Mappers). To use an instance mapper with an extension method, use:
25+
Mappings performed via these extension methods use the default mapper - the same one you map with via the [static Mapper API](/Static-vs-Instance-Mappers). To use an instance mapper with an extension method, use:
2626

2727
```cs
2828
// Deep-clone a Customer using

docs/src/Member-Matching.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
By default:
22

33
* Writable fields and properties, single-parameter methods prefixed with 'Set', constructor parameters and non-null, readonly complex type or enumerable members (except arrays) are targeted
4-
* Target members are matched to [compatibly-typed](Type-Conversion) source members by name
4+
* Target members are matched to [compatibly-typed](/Type-Conversion) source members by name
55
* Source members prefixed with 'Get' are matched without the prefix - [`GetHashCode`](https://msdn.microsoft.com/en-us/library/system.object.gethashcode%28v=vs.100%29.aspx) and [`GetType`](https://msdn.microsoft.com/en-us/library/system.object.gettype(v=vs.100).aspx) are ignored
66
* Members named `Id`, `<Type name>Id`, `Identifier` or `<Type name>Identifier` are matched
77
* Target members with no compatible source member are ignored.
@@ -37,7 +37,7 @@ public class Address
3737
When mapping `CustomerViewModel` to `Customer`:
3838

3939
- `Customer.Name` is populated using `CustomerViewModel.Name`
40-
- The `Customer.CustomerId` Guid is populated using the [parsed](Type-Conversion) `CustomerViewModel.Id` string
40+
- The `Customer.CustomerId` Guid is populated using the [parsed](/Type-Conversion) `CustomerViewModel.Id` string
4141
- `Customer.HomeAddress` is populated with a new `Address` instance if one does not already exist
4242
- `Customer.HomeAddress.Line1` is populated using `CustomerViewModel.HomeAddressLine1`
4343
- `Customer.WorkAddress` is get-only, so is ignored if it's null

0 commit comments

Comments
 (0)