./nugetz

#foundation

169 packages tagged with “foundation

Constellation.Foundation.ModelMapping

Requires Sitecore 10.3 Requires .NET 4.8 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 and DateTime 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: var modelMapper = (IModelMapper)ServiceLocator.ServiceProvider.GetService(typeof(IModelMapper)); // Dependency Injection of an IModelMapper is supported TModel viewModel = modelMapper.MapItemToNew<TModel>(sourceItem); Or: TModel viewmodel = item.MapToNew<TModel>(); Or: modelMapper.MapTo(item, model); When using Item or ItemList extensions for mapping, the context IModelMapper is requested from the ServiceLocator, so any moc objects you use for testing are supported with these extension methods. 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. - ViewModel properties can be: - - Strings - - HtmlStrings (recommended for RichText and FieldRenderer) - - Integers - - Decimals - - DateTimes - - Other ViewModels (recommended for DropLink, DropTree) - - ICollection Generics of other ViewModels (recommended for Multilist, Treelist) - - ModelMapping.Model.ImageModel (for Image Fields, gives access to all field properties and permits generating different kinds of image URLs on the View.) - - ModelMapping.Model.GeneralLinkModel (for General Link fields, gives access to all field properties through a single object.) - - Random Plain Old Classes as long as they are Where T: class, new() 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 - Should be a string, not a Uri. Causes the current context LinkManager to generate a Url for the Item. - Parent - Maps to the ViewModel you provide based on the Item.Parent. 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<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.

v10.3.0.23496425.0K
SitecoreSitecoreHelixFoundation

Constellation.Foundation.SitemapXml

Requires Sitecore 10.3 Requires .NET Framework 4.8 Constellation is a collection of utilities for .NET CMS implementers. The Foundation.SitemapXml namespace contains Http Handlers which intercept the request before it hits Sitecore. Robots.TXT Handler: Returns a basic document that automatically applies to all search engine agents. The stock configuration has disallows for /sitecore urls to prevent the login page from being indexed. Additional default or site specific rules can be added through the supplied configuration file. See instructions within the config file. Assuming a given Site's robots.txt does not deny the root of a site, the robots.txt file will include a link to the site's sitemap.xml file. Sitemap.XML Handler: Returns an on-the-fly document (there are cache options available) for each configured Site in your installation. The document is created by having one or more "crawlers" inspect the Content Tree generating the necessary Item facts and URLs required to produce the Sitemap. You can specify a set of default crawlers for your installation, as well as override the crawler list on a site-by-site basis. There are also provisions for excluding sites from returning a sitemap.xml document if it is not appropriate. Default Functionality: The system will function on a basic level "out of the box". There is a default Content Tree crawler that will start at the root of the current Site and include Items that have presentation details. The crawlers operate in the extranet\anonymous role and thus security can be used to "hide" Items or branches from the crawler. Crawler output has extensive support for "validating" whether an Item should be included in the sitemap or not. Facts available through the API include: - Does the Item have presentation? - Does the Item have explicit rules to prevent Search Indexing? - Does the Item represent a "Page"? It is up to the developer to supply meaningful decisions behind these facts, but answering "no" to any of them will result in the Item not being included. This library outputs substantial amounts of troubleshooting warnings to the Sitecore log file. If you're having trouble, search for Constellation.Foundation.SitemapXml in your log file. Multi-Language Support: For every "site" definition element in your Sitecore configs, add a "supportedLanguages" attribute that is a comma-delimited list of all languages available on your site (example: supportedLanguages="en-US,fr-FR,pt-PT") Doing this will force the sitemap.xml file to include "alternate" links for each language the site supports. Installation Warning: Your web.config must have a system.webServer/handlers section, and that section must have at least one handler in it (an "add" element) in order to install this package successfully. If you're using the default Sitecore web.config this won't be an issue. The handlers provided in this package must be inserted at the top of the stack of handlers.

v10.3.0.2463599.1K
SitecoreSitecoreHelixFoundation

Constellation.Foundation.Mvc

Requires Sitecore 10.3 Requires .NET 4.8 Constellation is a collection of utilities for .NET CMS implementers. The Foundation.Mvc assembly contains enhancements to Sitecore's MVC Rendering system: GenerateRenderingSpecificCacheKey Mvc.RenderRendering pipeline processor: Replaces the default GenerateCacheKey processor. Includes the ID of the Rendering in the cache key, this allows for multiple renderings with different presentation to use the same Datasource and be cached by Datasource without issues. MinifyAndAddRecordedHtmlToCache Mvc.RenderRendering pipeline processor: Replaces the default AddRecordedHtmlToCache processor. Uses the WebMarkupMin library to process the output HTML, Javascript, and CSS and minify it to improve page delivery time through file size reduction. The default settings are "safe" but effective, however WebMarkupMin offers far more aggressive minification settings for the bold. GetControllerRenderer Mvc.GetRenderer pipeline processor: Replaces the default GetControllerRenderer. Allows the developer to rely on the name of the Rendering to locate the appropriate controller to execute (convention over configuration). Very handy for Renderings that have a dedicated controller with one action that always produces the same output. ConventionController: Provides a good base-class controller for Sitecore implementations: * Forces the use of the Index() controller action (overrides possible) * Provides the programmer with immediate access to the Rendering's DataSource and ContextItem (PageContext) * Requires the programmer to assemble the model from the above Items. * Automatically finds the View based upon the Rendering's XPath location in Sitecore EditorCompatibleView: Replaces the stock MVC View, and provides methods for determining if the Page Mode "IsExperienceEditor" and "IsExperienceEditorEditing" which are of particular use if the View needs to change behavior to support editors. ViewPathResolver: Independent engine for locating a View based on the Rendering Item's path in Sitecore. It has configuration settings that allow the programmer to specify the location of Renderings in Sitecore and how they map to the location of the Views on disk. See the provided config file for details.

v10.3.0.2363177.7K
SitecoreSitecoreHelixFoundationMvc