Questions tagged [glass-mapper]
Questions relating to the Glass.Mapper.Sc ORM framework. More information about the framework is available here: http://www.glass.lu/
248
questions
3
votes
2
answers
656
views
Not able to edit fields in experience editor after upgrading to Sitecore 9.2 with glass 5.6
Working on an upgrade from Sitecore 8.2 to 9.2, I also upgraded glassmapper 4.3 to 5.6
In glass 5 also some changes in the controllers:
Glass 4:
public class MainVisualController : ...
0
votes
2
answers
722
views
Extra P tag is added in Single-Line-Text while updating from Experience Editor in Sitecore 9.3
I am using Siteore 9.3 also using Glass mapper 5 and I have one Single-Line-Text and I am binding value just like mentioned below:
<div class="heading-5 header-text">@Html.Glass().Editable(...
2
votes
2
answers
254
views
How to map tracking field with glass mapper
Using native Sitecore ways, the following can be achieved by doing:
var pageItem = Sitecore.Context.Item;
var trackingField = new TrackingField(pageItem.Fields["__Tracking"]);
The question is ...
2
votes
1
answer
1k
views
Glassmapper 5 GetItem in language version
I need to extract an item with Glassmapper in specific language. But in Glassmapper 5 this method is marked as "Obsolete":
_sitecoreService.GetItem<IAvailableCountries>
(...
2
votes
1
answer
109
views
Sitecore Glass Mapper 5.5.28.0 BaseChildren.OfType not working
We have upgraded our sitecore website to Sitecore 9.2 and also updated our Glass Mapper to version 5.5.28.
Currently, we noticed that we can't get the children on our iteration when we specify the ...
1
vote
2
answers
198
views
How to pass language to Glass BeginRenderLink
I have a Link field in Sitecore where user could choose any link,
site has multiple languages and cultures.
In case if user sets a page in the link field that does not have language in current context,...
1
vote
1
answer
937
views
Glass Mapper v5 not mapping Glass.Mapper.Sc.Fields.Link fields correctly
We are upgrading Sitecore to 9.3 and glass mapper to Glass.Mapper.Sc.93 (v5.6.158-alpha). Having an issue with most of our Glass.Mapper.Sc.Fields.Link types coming back as null. which used to work ...
1
vote
1
answer
206
views
Not able to get count from Search response using Glass Mapper
Environment details: Sitecore 9.0.2 with Solr and GlassMapper
I am using the method:
public IEnumerable<TModel> GetAll<TModel>(string query, string language) where TModel : class
...
4
votes
1
answer
1k
views
Getting full image URL using Glass Mapper without RenderImage
Html.Glass().RenderImage(Model, x => x.Logo, new { mw = 200 }, Editable:true)
The code above outputs an img tag with the full URL including the hashed parameters.
I want a way to get just the ...
3
votes
2
answers
1k
views
Experience Editor issue after upgrading to Sitecore 9.3
After upgrading to Sitecore 9.3 getting below error in Experience Editor:-
sitecore Method not found: 'Void Sitecore.Pipelines.GetChromeData.GetChromeDataProcessor
We are using Glass Mapper
1
vote
1
answer
805
views
Glass mapper returning null for shared fields with values
I have an SXA site. It has language fallback enabled on the site node. Page and component datasource templates' standard values have had both their item level and field level fallback enabled for non-...
1
vote
1
answer
112
views
String not geting rendered in Experience Editor
Environment: Sitecore 9.0.2 + Glass mapper
I have a model class like this:
public class SingleStack
{
public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
public string ...
3
votes
1
answer
746
views
Glassmapper | Cannot save a class that does not contain a property that represents the item ID
Environment: Sitecore 9.0.2 + Glass Mapper
I have a class like this:
public class Sample
{
public Glass.Mapper.Sc.Fields.Image Logo { get; set; }
public string Destination_Name { get; set; }...
4
votes
0
answers
194
views
SitecoreRequestScopeModule holding many objects leading to memory leak
We are seeing a steady memory growth on our Sitecore 8.2 update 1 application. We had AUTOFAC DI previously and have been completely replaced with Sitecore OOB MS DI.
We followed some guidance from ...
4
votes
2
answers
403
views
Rendering images through TreelistEx
Environment: Sitecore 9.0.2 + Glassmapper
I am trying to create a component like this.
So in the template, for the images (stored in Sitecore Media Library), I have taken a field of type TreeListEx.
...
1
vote
1
answer
251
views
Glass GetItems not returning sorted items
I am not able to get glass to return items sorted correctly.
I have this code.
var options = new GetItemsByQueryOptions(new Query($"<mypath>/*"));
var myitems= this.contentRepository....
1
vote
0
answers
329
views
MVC Layout model is empty after Glass Mapper Upgrade
We recently upgraded from Sitecore 8.2.0 to Sitecore 9.2.0. Along with other packages, we also upgraded to the latest compatible version of Glass Mapper 5 for Sitecore 9.2.0.
We use Simple Injector ...
1
vote
1
answer
414
views
High CPU and Memory with 2 million glass disposables
We have been seeing the high CPU and constant growth of memory. When analyzing the memory dump I noticed that the memory is occupied by 2 million Glass Mapper objects.
Has anyone faced this issue and ...
2
votes
1
answer
536
views
Mapping Class with multiple Sitecore templates in [SitecoreType()] Attribute
I have to map a class with more than one template in GlassMapper. My code is like below.
[SitecoreType(TemplateId = "{6173F07E-BC5B-4409-A75A-DF1B0D117C41}", AutoMap = true, EnforceTemplateGlass....
0
votes
1
answer
272
views
Using Glass to add content with fluent config - map to interface and concrete class
My typical build-out for Glass and fluent config is to use an interface and map file (using SitecoreGlassMap) for modeling, but I know if I need to use the model to add data to Sitecore I can't use ...
-1
votes
1
answer
625
views
Glass Mapper is not returning an Image Field
I have a model that looks like this:
[Serializable]
[SitecoreType(TemplateId = "{guid}", AutoMap =true)]
public class EventInfo : GlassBase
{
public virtual string PageTitle { get; set; }
...
0
votes
0
answers
107
views
SitecoreQuery issue in glass mapper
I use glass mapper 5.3 and I use SitecoreQuery in this field:
[SitecoreQuery("/sitecore/content/Newsroom/Data/Enumerations/Companies/*")]
public virtual IEnumerable<EnumerationValueItem> ...
0
votes
1
answer
52
views
Map user profile fields via Glass
I've created a custom user profile and attached it to a user type. When I do a GetUser and tell it I want the profile properties, is there a mechanism to map this data to a Glass model, or is this ...
1
vote
1
answer
849
views
Glassmapper 5 SitecoreChildren listing items even if the version count is 0
We upgraded Glass Mapper version from 4.2.1.190 to 5.4.21.0.
In our model, we are using [SitecoreChildren(InferType = true)] to get the child items. For few of the child items, language fallback is ...
4
votes
1
answer
2k
views
How do I map a list of Templates with Glass Mapper?
I've got a TreeList field on one of my templates that allows me to select multiple templates. I'm having trouble mapping this to my model with Glass Mapper.
[SitecoreType(TemplateId = "{Template-Id-...
1
vote
2
answers
741
views
Glassmapper 5.1 Error when Datasource has no version
We recently upgraded our Sitecore to 9.1 and also Glassmapper5.4.21 along with it.
What we noticed is that some of the view renderings have a data source that does not have a version in a particular ...
1
vote
1
answer
302
views
Editable in a foreach loop?
I know I've done this before but I just don't remember the proper syntax. I have a page where the model is EventItem, and EventItem has a list of EventSpeakers and each speaker has an image field. I ...
0
votes
1
answer
719
views
The model item passed into the dictionary is of type 'Sitecore.Mvc.Presentation.RenderingModel'
We recently upgraded to 9.1 and updated our glassmapper to 5.4.1.
After doing the upgrade and running our application I am getting this error.
We dont have any model definition in siteocre and this is ...
1
vote
1
answer
146
views
Can I use Content Search with Glass to query children of a specific template?
My Sitecore Item has children of different Templates.
To query them, I use the following field declaration:
[SitecoreQuery("*[@@templateid = '{ID of my Template}']",
InferType = true, IsRelative = ...
2
votes
1
answer
767
views
Glass Mapper - Item not null when language version not present
I'm using Glass 5.4.18 with Sitecore 9.0.2. I have a base template for my site that has language fallback turned on by default, but for a few items the client wants to disable language fallback so the ...
3
votes
1
answer
661
views
Sitecore GlassMapper and Json.NET
I need to pass parameters in Json format from Sitecore item. I am getting Sitecore item using GlassMapper.
public interface ISomeType
{
//some fields
}
public interface ISomeFolder
{
...
1
vote
2
answers
381
views
Map text field to nested object
I have a model which has two nested classes within. I am unable to find any resources how to map this correctly.
In Sitecore the Address.cs corresponds to the template Address which has a droplink to ...
2
votes
1
answer
112
views
Dealing with different types of SitecoreParent
Templates A and B both inherit from Templates C.
I have an item that can have either an A or a B as parent.
How can I use the [SitecoreParent] attribute in order to retrieve either according to the ...
1
vote
1
answer
479
views
How do I programmaticaly set an image on glassmapped item
So I have a glassMapped item with an image.
[SitecoreType(TemplateId = TemplateIdConstants.NationalChain, EnforceTemplate = SitecoreEnforceTemplate.Template)]
public interface IChain : IGlassBase
{
...
0
votes
0
answers
156
views
How to upgrade Glass Mapper code that uses AbstractGlassUserControl?
I am upgrading some Glass Mapper code that I inherited. The previous version of Glass Mapper was v3 and I am upgrading to v5.3.17.
I have a class that looks like this:
public class MyRepository : ...
-1
votes
2
answers
707
views
Space with 'Name Value List' in Sitecore
We are using Glass Mapper to map the values from Sitecore.
System.Collection.Specialized.NameValueCollection is used in Glass Mapper class to map Name Value List from Sitecore.
This example data is ...
0
votes
1
answer
131
views
Experience Analytics page conflict with Glass Mapper
I'm getting the following error message when I go to Experience Analytics from the dashboard in 9.0.2 (rev. 180604). We are using Glass Mapper elsewhere in the application, but there's no ...
2
votes
1
answer
1k
views
Sitecore Glass Mapper 5.3.15 not loading children by default
I have upgraded the website to Sitecore 9.0.2 and since my project has a dependency on Glass mapper, I have upgraded Glass mapper to 5.3.15.
My Glass mapper maps to the menu model and it does load ...
0
votes
0
answers
217
views
Some fields are not being saved in experience editor
I have a component that has following fields:
Title
Image
Link Title
Link
Among these fields, Title and Link Title are not being saved while editing in the Experience Editor, upon ...
1
vote
0
answers
180
views
Glass GetRenderingParameters SQL query
We are using the method GetRenderingParameters<T>() from Glass in many different places in our code. This method works correctly, it returns the rendering parameters as a strongly typed object.
...
1
vote
1
answer
267
views
Droplink value is always returning null in post action
I am trying to build a form which contains state as droplink and given datasource as states .
here's the snippets of my employee model and state.
i am getting all the states in the get action of ...
1
vote
1
answer
731
views
Equals sign (=) added after valueless query string parameters
When rendering an external link from a General Link field using the Glass Mapper BeginRenderLink helper, any query string parameters without values are getting an equals sign (=) added after them.
An ...
2
votes
1
answer
5k
views
How to get children of an item via glass mapper?
I am building a navigation component using glass mapper. The problem I am facing is not being able to get children items of a navigation item.
Right now I am only getting Parent navigation items.
...
1
vote
1
answer
273
views
Dynamically Generated Rendering not displaying in experience editor in SXA Multi Tenant Solution [closed]
When working with with SXA inside of a multi-tenant solution, we are building a component to generate an HTML sitemap.
We have implemented a recursive function to generate the html sitemap ...
6
votes
1
answer
3k
views
After upgrading to Glass Mapper 5, unable to globally enable lazy loading
In the implementation using Glass Mapper 4.3.x, I was enabling Lazy Loading in GlassMapperScCustom:
public static IDependencyResolver CreateResolver(){
var config = new Glass.Mapper.Sc....
0
votes
0
answers
318
views
Implementing a Carousel with Glass Mapper for Sitecore
I am new to Sitecore hence, looking for help from Sitecore enthusiasts.
I am implementing a carousel using Glass Mapper (V8.2)
I have a data source (a simple folder) which has three carousels as ...
1
vote
1
answer
227
views
Is there anything wrong with using BeginRenderLink and changing the querystring parameters with a controller rendering?
Right now in our view we have something like this:
using (BeginRenderLink(x => x.ButtonLink, new { @class = "primary-button", style = style }, isEditable: true))
{
@Editable(x => x....
1
vote
1
answer
121
views
Is there a way to append an indexed field to a glass mapper object?
I'm generating a custom sitewide search by indexing the rendered HTML of the pages on my site.
Some pages will have a title and description field defined to display in the results, however, some ...
0
votes
1
answer
653
views
How do I map a Time field using Glass.Mapper?
I've got a field in my template of type Time, the template is published and I've entered a value in my item but I'm not getting a value in my datasource.
I've tried DateTime and TimeSpan for the ...
2
votes
0
answers
836
views
Glass Mapper v5 Item creation issue
I'm using Sitecore 9.0 Update 2 with Glass Mapper.Sc version 5.2.13
I'm trying to create items in Sitecore using GlassMapper and the following code
repository.RequestContext.SitecoreService....