lazy-loading

Linq-To-Entities Include

二次信任 提交于 2019-12-04 12:39:06
I'm currently learning a bit more about Linq-To-Entities - particularly at the moment about eager and lazy loading. proxy.User.Include("Role").First(u => u.UserId == userId) This is supposed to load the User, along with any roles that user has. I have a problem, but I also have a question. It's just a simple model created to learn about L2E I was under the impression that this was designed to make things strongly type - so why do I have to write "Role"? It seems that if I changed the name of the table, then this wouldn't create a compilation error... My error is this: The specified type member

CommandLink not Working on a Lazy Loaded Primefaces Datascroller

送分小仙女□ 提交于 2019-12-04 12:35:33
问题 I'm having an issue with lazy loading a Primefaces Datascroller component. I have a jsf page that should display 10 events on page load. If the user wants to see more he/she can click the more button to load and display the 10 next events. For each of the event rows, there is a link that can be used to display the event's details. <h:form id="mainForm" > <p:dataScroller value="#{backing.lazyModel}" var="event" lazy="true" chunkSize="10" rowIndexVar="index"> #{event.name} <p:commandLink class=

Hibernate ignores 'lazy' fetch type and loads properties immediately

一曲冷凌霜 提交于 2019-12-04 11:50:20
I use Hibernate 5.2.5 (also use kotlin and spring 4.3.5 if that matters) and I want some of the fields of my class to be loaded lazily. But the issue is that all fields are loaded immediately, I don't have any special Hibernate settings neither use Hibernate.initialize(). @Entity(name = "task") @Table(name = "tasks") @NamedQueries( NamedQuery(name = "task.findById", query = "SELECT t FROM task AS t WHERE t.id = :id") ) class Task { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) var id: Int? = null @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "author_id", nullable = false)

Lazy Load won't load visible images

安稳与你 提交于 2019-12-04 11:44:30
问题 I'm trying to use lazyload to only load images that are visible (because my site is responsive and some content is hidden with display:none to clients on a smaller screen). Basically, lazyload works, but ONLY after I scroll the page a little. This is the lazy load settings I'm using, and even after setting the threshold to 2000px (more than the entire page height) it still only loads images after the user scrolls the page (even 1 px). This bug only appears in webkit browsers. $(document)

NHibernate.LazyInitializationException

好久不见. 提交于 2019-12-04 11:17:05
问题 We have been having this issue pop up sporadically, but now I can reproduce it every time. I am incrementing a view counter on my custom built forums, which causes an error: NHibernate.LazyInitializationException: failed to lazily initialize a collection, no session or session was closed This error occurs on another collection in the object. If I add: .Not.LazyLoad() To my Fluent mapping, the error shifts around my project. I kept disabling lazy loading on objects intil it going to a spot

Entity Framework and Object Context lifetime in ASP.NET MVC

爷,独闯天下 提交于 2019-12-04 10:45:25
I'm using Entity Framework in my project, and I have the problem that, once I pass my entities to a View (keep in mind that these entities have lazy-initialized objects along the lines of: Products.Owner, where owner is an object that is lazily initialized) I get a run-time exception telling me that the ObjectContext is out of scope. Now this makes sense since I am getting the entities from a Service with a using (.... entities...) { .... } statement, which means it is disposed when the result is returned. How would I get around this and have an Object Context that is alive from start to end.

How to fix a NHibernate lazy loading error “no session or session was closed”?

瘦欲@ 提交于 2019-12-04 10:30:05
I'm developing a website with ASP.NET MVC, NHibernate and Fluent Hibernate and getting the error " no session or session was closed " when I try to access a child object. These are my domain classes: public class ImageGallery { public virtual int Id { get; set; } public virtual string Title { get; set; } public virtual IList<Image> Images { get; set; } } public class Image { public virtual int Id { get; set; } public virtual ImageGallery ImageGallery { get; set; } public virtual string File { get; set; } } These are my maps: public class ImageGalleryMap:ClassMap<ImageGallery> { public

unloading/destroying Angular lazy loaded components

匆匆过客 提交于 2019-12-04 10:13:15
I have a setup that is similar to the post found here http://ify.io/lazy-loading-in-angularjs/ to handle lazy loading various components of my app in Angular. The problem I'm having is that the more components one loads, the memory footprint of the app grows (obvious, I know). Is there a clean way to 'unload' or 'destroy' angular services / controllers/ directives / etc that have been lazy loaded? simple example (for reference) app.js var app = angular.module('parentApp', ['ui.router']).config(function ($stateProvider, $urlRouterProvider, $controllerProvider, $compileProvider, $filterProvider,

How to handle “image corrupt or truncated” in firefox

£可爱£侵袭症+ 提交于 2019-12-04 10:06:58
问题 PLUGIN I am using a jQuery plugi called lazyload. What this does is lazy load images - meaning it does not render them in the browser until the image is within the scope of the viewport. This is useful when you have a page that has many images, for example, and you don't want it to spend forever with the initial load. FIREFOX Ok, so I am also using Firefox version 23.0.1 PROBLEM The plug in is great, however when scrolling down after some images I start getting errors where the image doesn't

ngx-translate not showing any text in lazy-loaded module

做~自己de王妃 提交于 2019-12-04 09:11:45
We are using Angular 6 in our application. We recently started to prepare our app fro lazy-loading. Application has multiple lazy-loaded routes. We want to use a single language file for all routes (don't need to separate it into chunks. But load all translations on bootstrap). First thing I tried was just to import and configure ngx-translate in AppModule (forRoot) and nowhere else. For that purpose I created a configuration file for TranslateModule with the following code: import { MissingTranslationHandler, MissingTranslationHandlerParams, TranslateLoader, TranslateModuleConfig } from '@ngx