Constellation.Foundation.ModelMapping 9.0.7.25385

Constellation is a collection of utilities for .NET CMS implementers.

The Foundation.ModelMapping library is inspired by AutoMapper and is designed to provide a quick, non-ORM method of
mapping Sitecore Items to ViewModels. String properties on your ViewModel will be mapped to FieldRendered values from fields with the
same names. Integer, DateTime, and Uri property types can also be handled automatically, although you will not get page editor support
for these types. There are a number of Attributes that you can assign to your ViewModel's properties to change the behavior of the Mapper.

Usage: TModel viewModel = ModelMapper.MapItemToNew<TModel>(sourceItem);

Constraints:
- Your ViewModel must have a public, parameterless constructor.
- Only Writable, Public Instance properties will be mapped.
- Within Sitecore, your field names can be human-legible. ModelMapper will attempt to convert the field name to a valid Property name. Simpler names work best.
You can use the Field's Display Name for better human legibility and keep the Field's actual name closer to a legit C# entity name.

The following Model properties are mapped to Item properties rather than Item fields:
- ID - Maps to the Item.ID - Make sure you use Sitecore.Data.ID as the property type.
- Name - Maps to the Item.Name
- DisplayName - Maps to Item.DisplayName
- Url - can be a string or a Uri type. Causes the current context LinkManager to generate a Url for the Item.

Support for XML Field Attributes
- ImageField.Alt - use Model.FieldNameAlt
- ImageField.Height - use Model.FieldNameHeight
- GeneralLink.Target - use Model.FieldNameTarget
- etc.

Support for LinkField.TargetItem - use Model.FieldNameTargetItem and supply a class with public properties and a parameterless constructor.
Support for MultilistField.GetItems - use Model.FieldName and supply a generic ICollection of type "T" where "T" is new() and has properties you can map.

Extensible! See the Constellation.Foundation.ModelMapping.config file to change the way Fields are processed.

Configured for use with Sitecore 9.0.
Requires Sitecore 9.0 NuGet packages, available here: https://sitecore.myget.org/F/sc-packages/api/v3/index.json

There is a newer version of this package available.
See the version list below for details.
Install-Package Constellation.Foundation.ModelMapping -Version 9.0.7.25385
dotnet add package Constellation.Foundation.ModelMapping --version 9.0.7.25385
<PackageReference Include="Constellation.Foundation.ModelMapping" Version="9.0.7.25385" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Constellation.Foundation.ModelMapping --version 9.0.7.25385
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Release Notes

Added Fields.ReadAll() to get standard values. Oops.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
9.1.11.16238 0 2/28/2020
9.1.10.19264 96 12/20/2019
9.1.9.30419 59 12/19/2019
9.1.8.25631 49 12/9/2019
9.1.7.27091 45 12/6/2019
9.1.6.15984 191 6/4/2019
9.1.5.27908 117 6/3/2019
9.1.4.28433 115 5/28/2019
9.1.3.23444 147 4/11/2019
9.1.2.24353 164 3/6/2019
9.1.1.23876 182 1/18/2019
9.1.0.16301 213 12/7/2018
9.0.33.27934 170 10/25/2018
9.0.32.25356 158 10/20/2018
9.0.31.30043 163 10/19/2018
9.0.30.20651 162 10/18/2018
9.0.30.16759 170 10/18/2018
9.0.29.16036 166 10/18/2018
9.0.28.29823 189 10/17/2018
9.0.27.22655 164 10/16/2018
9.0.26.31767 164 10/14/2018
9.0.25.30713 158 10/14/2018
9.0.24.28294 187 10/14/2018
9.0.23.20463 253 7/23/2018
9.0.22.29260 265 7/3/2018
9.0.21.16778 289 5/31/2018
9.0.20.26586 260 5/25/2018
9.0.19.21403 295 5/18/2018
9.0.18.17384 327 2/20/2018
9.0.17.20638 309 2/12/2018
9.0.17.17874 300 2/12/2018
9.0.16.23947 278 1/12/2018
9.0.15.30124 301 1/11/2018
9.0.14.22754 292 1/11/2018
9.0.13.26948 250 1/10/2018
9.0.13.20538 298 1/10/2018
9.0.12.19321 304 1/10/2018
9.0.11.23261 299 1/8/2018
9.0.10.18305 308 12/8/2017
9.0.9.27813 362 12/6/2017
9.0.9.24928 294 12/6/2017
9.0.9.19108 283 12/6/2017
9.0.8.28378 258 12/5/2017
9.0.7.25385 252 12/5/2017
9.0.6.28191 248 12/4/2017
9.0.5.22638 264 12/3/2017
9.0.4.21382 258 12/3/2017
9.0.4.21146 247 12/3/2017
9.0.3.27874 287 12/1/2017
9.0.1.27414 249 11/30/2017
9.0.1.18427 258 11/30/2017
9.0.0.35644 284 11/29/2017
9.0.0.30418 256 11/29/2017
9.0.0.27220 250 11/29/2017
Show less