Questions tagged [glass-mapper]

Glass.Mapper is a Sitecore module that provides an ORM solution for the Sitecore CMS.

Glass.Mapper is an open source object mapping framework for .NET CMS systems

302 questions
3
votes
2 answers

How to retrieve a collection of fields in Glass model?

Is it possible to retrieve a collection of fields as a property of a mapped glass model ? For example, I have a "Product" item in Sitecore with a collection of custom "Product Attribute" fields. I'd like to be able to access these fields as a…
epik phail
  • 195
  • 8
3
votes
1 answer

Using a generic type in a Sitecore view rendering with Glass Mapper

Setup Models POCOs, virtual is required by Glass Mapper. using System.Collections.Generic; using Glass.Mapper.Sc.Configuration.Attributes; using Glass.Mapper.Sc.Fields; namespace Sample { public class Parent { [SitecoreId] …
Simon Ingeson
  • 951
  • 7
  • 10
3
votes
1 answer

ASP.NET MVC Razor Syntax: Is it an issue for razor to interpret @if(@Model

I am checking logs of exception and I came across an exception in lazy loading with glass mapper. I have a sitecore project with mvc and one of the views (shared cshtml) contains the following loop: @foreach(var item in @Model.Collection)... I…
nkalfov
  • 439
  • 5
  • 12
3
votes
1 answer

Rendering parameters incorrect when multiple of same rendering

I'm having an issue with a rendering I'm building in Sitecore 8 Update 3, using MVC with Glass Mapper v4. I have a Feature Promo rendering that has a Rendering Parameter Template Feature Promo Parameters which defines a droplist field named Align…
James Simm
  • 1,569
  • 1
  • 16
  • 28
3
votes
1 answer

Glass.Mapper.Sc set inferType to true by default globally

In Glass.Mapper.Sc v 4.0.1.5 ISitecoreService and ISitecoreContext have all their method signatures with inferType default to false. I'm looking for a way to override that and default to true without changing the method calls all over the site. I…
Mark Saad
  • 75
  • 3
3
votes
1 answer

Glass Mapper V4 Language Item Fallback, how to make it work with Autofac?

I am using Glass Mapper v4 with Autofac and cant figure out how to make it work with the Language Item Fall back module. There are examples of creating a class that implements IObjectConstructionTask (see below) public class FallbackCheckTask :…
mluker
  • 702
  • 8
  • 26
3
votes
1 answer

Missing InstanceContext when upgrading from Glass.Mapper.Sitecore to Glass.Mapper.Sc

I'm upgrading a project from Glass Mapper v2 (Glass.Mapper.Sitecore) to v4 (Glass.Mapper.Sc) and I ran into an issue where our solution was using the InstanceContext object to get classes by template Id. I couldn't find that InstanceObject or a…
Mark Saad
  • 75
  • 3
3
votes
1 answer

How to use Glass Mapper 3.3 with Sitecore 7.x and Solr 4.7

Has anyone else had problems getting Sitecore 7.x and Solr 4.7 to work with Glass Mapper 3.3? It seems like Glass Mapper uses the Castle Windsor IOC container. And Sitecore recommends using the Castle Windsor IOC container for Solr also. According…
Corey Burnett
  • 7,312
  • 10
  • 56
  • 93
3
votes
2 answers

Sitecore Glass Mapper Constructor Dependency injection in the model - is this possible in MVC?

In web forms I would use constructor dependency injection in my models like the below: [SitecoreType(AutoMap = true)] public class Article { private readonly ICommonService _commonService; public Article(ICommonService commonService) { …
3
votes
1 answer

Sitecore/Glass Mapper: how to return query in order of content tree

We have a site with several queries that query the direct children of a content item. We simply want just the children sorted by the order they appear in the content tree. We're using Glass Mapper and our collection properties look like…
Scott
  • 1,011
  • 1
  • 15
  • 30
3
votes
2 answers

Glass Mapper, TDS Code Generation and Rich Text field in Sitecore

Using Glass.Mapper version 3.0.13.25. Using TDS 5.0.0.23 Code Generation (glassv3header.tt and glassv3item.tt). I have a new Item that I am trying to add to Sitecore. I'm populating a Product object that was created through TDS' Code…
3
votes
2 answers

How to lazy load a property with custom attribute

I want to create a custom attribute using Glass Mapper for getting the Sitecore URL, because it is not possible to lazy load a property with SitecoreInfo(SitecoreInfoType.Url) and we have some performance issues loading URL of mapped items, where…
Tineler
  • 253
  • 3
  • 17
3
votes
2 answers

Sitecore Glass mapper and File Field type

I have a PDF link on a page, for which I've used File field type in Sitecore. I can get the view to render fine but I can't make the File field type editable. I haven't been able to find any documentation around it either. Could you show me an…
Gabbar
  • 4,006
  • 7
  • 41
  • 78
3
votes
2 answers

How can I get the sitecore field from an object property, mapped by glassmapper?

We are using Glass Mapper with Sitecore, with our models we can get the values of sitecore fields. But I want to easily get the sitecore fields(sitecore field type) by using the model without hardcoding any strings (when using GetProperty(), you…
zhanke
  • 671
  • 7
  • 25
3
votes
1 answer

Map Multilist field with objects of different templates

I have a multilist field on an item that can contain items from different templates. I was wondering if there was any way to map this field in such a way that the objects are mapped to the correct model based on their template. So for…
Kyle
  • 4,261
  • 11
  • 46
  • 85