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
10
votes
1 answer

Glass Mapper + Unity

I understand that the Glass Mapper v4 can now be used in conjunction with any IoC container. But I'm struggling to find a code example of how to achieve this. I want to be able register glass components and inject them into my controllers using…
David Masters
  • 8,069
  • 2
  • 44
  • 75
10
votes
1 answer

Glass Mapper: InferType is ignored when querying the SitecoreContext

I have installed the package Glass.Mapper.Sc.CastleWindsor in version 3.1.2.11 on my Sitecore 7.1 solution and am trying to work with inferred types. I have the following classes: [SitecoreType] public class ServiceConfiguration { …
Kevin Brechbühl
  • 4,717
  • 3
  • 24
  • 47
9
votes
3 answers

How to render link with css class with Sitecore Glass Mapper

I have the following link: View details » How can I render the link with sitecore glass that it still keeps the css class? With the field renderer in sitecore you used to be able to pass the class along as…
5earch
  • 289
  • 2
  • 4
  • 15
7
votes
1 answer

Glass Mapper breaking standard values for image field

Consider the template: Company Logo (Image field) Company Name (Text field) The Company template has standard values set on both fields. If we get a Company item and save it using Glass without making any changes, the Logo field no longer uses the…
Dan Sinclair
  • 907
  • 1
  • 9
  • 27
7
votes
2 answers

Sitecore glass mapper general link in Mvc 4

Hi i'm currently learning sitecore 7 with MVC4 and glassmapper and I'm having some issues with the general linkfield. I can't seem to ouput the external links (not links to items) correctly from a general linkfield. What am I doing wrong? My…
Filip Huysmans
  • 1,301
  • 1
  • 20
  • 44
6
votes
2 answers

How to apply standard values to an item created with Glass.Mapper

I create a Sitecore item through the Glass.Mapper like this: var homeItem = sitecoreContext.GetHomeItem(); // Create the car item ICar car = sitecoreService.Create(homeItem.BooksFolder, new Car { Tires = 4, Seats=4}); This works, except…
Torben Junker Kjær
  • 4,042
  • 4
  • 34
  • 33
6
votes
2 answers

Glass mapper Render Image data attributes

I'm trying to render a image field with RenderImage. I need some data- attributes in the image but I can't seem to figure out how to go about implementing that. I've tried this but doesn't work @RenderImage(image, x => x.Image, new…
Gabbar
  • 4,006
  • 7
  • 41
  • 78
6
votes
3 answers

Sitecore Glass Mapper always null

I am using Sitecore Glass Mapper for a new project I'm setting up. We are using Sitecore 7.2, latest version of Team Development for Sitecore (TDS) code generation and the latest version of glass. The code I am trying to execute: var b = new…
Hans Leautaud
  • 1,742
  • 1
  • 19
  • 34
6
votes
2 answers

Can Glass.Mapper V3 support language fallback (field-level and item-level)?

We just updated our project to use Glass.Mapper V3. We LOVE it. But we've encountered an issue. It doesn't seem to respect language fallback. We have our site set up so that if a user picks a non-default language, they will see the item of that…
Dan Sinclair
  • 907
  • 1
  • 9
  • 27
5
votes
0 answers

Language Fallback doesn't work for glass Sitecore query

I am using sitecore 8.2 and glassmapper 4.3. I am able to get fallback item using Isitecorecontext.GetItem(path) but when I tried to read item using sitecore query like below public partial interface T { …
Sunil Aher
  • 747
  • 3
  • 14
  • 34
5
votes
0 answers

Sitecore 8.1 MVC Glass Mapper v4 ImageField renders height and width attribute in Page Editor

We're using GlassMapper 4.0.5.54 in Sitecore 8.1 Update 1 MVC. The problem is, when rendering an ImageField, the height and width attributes are written in the img-tag - but only in Page Editor mode. We tried different approaches…
z00mable
  • 304
  • 2
  • 11
5
votes
2 answers

"You cannot save a class that does not contain a property that represents the item ID" when GlassCast(ing) a branch template item, why?

I've been banging my head against this all day and I've run out of ideas. Basically because glass.mapper doesn't appear to support branch templates I'm creating a sitecore item using the standard DB methods. I then use GlassCast() to give me a…
Liam
  • 27,717
  • 28
  • 128
  • 190
5
votes
1 answer

Why should all Glass.Mapper fields be virtual?

The Glass.Mapper documentation states: using Glass.Mapper.Sc.Configuration.Attributes; namespace Glass.Mapper.Sites.Sc.Models.Landing { public class HomePage { public virtual string Title { get; set; } public virtual string…
Liam
  • 27,717
  • 28
  • 128
  • 190
5
votes
3 answers

Glass Mapper v4 InferType Cast issue

I can't understand why Glass Mapper can't cast object in correct way like described here I have next classes public class BC { [SitecoreId] public virtual ID Id { get; set; } } public class WB : BC { …
Arbejdsglæde
  • 13,670
  • 26
  • 78
  • 144
5
votes
0 answers

Sitecore Glass Mapper Null reference exception on some model properties

I have upgrade to GlassMapper version 4.0.1.8 and I'm experiencing strange behavior with some model properties. All my models are generated by TDS and most of them work fine. On one model Glass Mapper threw a null-reference exception on one specific…
Martijn van der Put
  • 4,062
  • 1
  • 18
  • 26
1
2 3
20 21