This is a migrated thread and some comments may be shown as answers.

Problem load data

3 Answers 73 Views
Databases and Data Types
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Manuel
Top achievements
Rank 1
Manuel asked on 02 Nov 2011, 03:16 PM
Hi there,

My silverlight application is a little slow when load the data, and sometimes give this error, look at the image please.

Any idea whats that? Maybe for take some time load data and give timeouts?

Thanks in advance, this is important.


3 Answers, 1 is accepted

Sort by
0
Ivailo
Telerik team
answered on 02 Nov 2011, 04:39 PM
Hi Manuel,

In order for us to analyze the possible reasons behind this slowness, could you give us some details regarding how are you exposing the data? What kind of service are you using and which controls are presenting the data? Also, if you can you send your Domain Model (RLINQ files or the mapping code in case you are using Fluent API) so that we can evaluate if there are any optimizations that can be done there.

We are looking forward to your feedback.

All the best,
Ivailo
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

0
Manuel
Top achievements
Rank 1
answered on 04 Nov 2011, 12:27 PM
Hi there,

Ok, in my all pages I use Load Operation to load the data. I´m not sure if this is the best way, or if exist some other option to load data quickly.

I also have a global variable do type SGADomainContext that is my context, so when the application starts all information of database goes to this variable, but this part I think that is fast, but is the correct?

Then, in my all pages, I need load data from database, so I use this to populate my observable collections:

public void CarregaParticipantesReuniaoQuePodemVotar()
        {
            try
            {
                BloquearLeituraEscritaDados = true;
                LoadOperation<ParticipantesReuniao> loadOp = AppGlobais.Globais.ContextoSGA.Load(AppGlobais.Globais.ContextoSGA.GetParticipantesReuniaosQuePodemVotarQuery(AppGlobais.Globais.reuniaoGlobal.IdProp), LoadBehavior.RefreshCurrent, CarregaParticipantesReuniaoQuePodemVotar, false);
            }
            catch (Exception Erro)
            {
                parametrosJanela.Closed = null;
                parametrosJanela.Header = "Erro a carregar intervenientes da reunião";
                parametrosJanela.Content = "\n" + Erro.Message;
                RadWindow.Alert(parametrosJanela);
            }
        }

        void CarregaParticipantesReuniaoQuePodemVotar(LoadOperation<ParticipantesReuniao> loadOperation)
        {
            try
            {
                List<ParticipantesReuniao> listaParticipantesQuePodemVotar;
                listaParticipantesQuePodemVotar = (List<ParticipantesReuniao>)loadOperation.Entities.ToList();
                OCParticipantesReuniao = new ObservableCollection<ParticipantesReuniao>(listaParticipantesQuePodemVotar);

                if (OCParticipantesReuniao.Count > 0)
                {
                    ParticipanteReuniaoSeleccionado = listaParticipantesQuePodemVotar.FirstOrDefault();
                }
            }

            catch (Exception Erro)
            {
                parametrosJanela.Closed = null;
                parametrosJanela.Header = "Erro a carregar intervenientes da reunião";
                parametrosJanela.Content = "\n" + Erro.Message;
                RadWindow.Alert(parametrosJanela);
            }
        }

This is correct?

Here is an example of a class of my model:

using System;
using System.Data;
using System.Linq;
using System.Linq.Expressions;
using System.Data.Common;
using System.Collections.Generic;
using Telerik.OpenAccess;
using Telerik.OpenAccess.Metadata;


namespace SGA.Web    
{
    [Table("ANEXOS")]
    [KeyGenerator(KeyGenerator.Autoinc)]
    public partial class Anexos
    {
        private long _Id;
        [Column("ID", OpenAccessType = OpenAccessType.Decimal, IsBackendCalculated = true, IsPrimaryKey = true, Length = 22, SqlType = "NUMBER")]
        [Storage("_Id")]
        public virtual long IdProp
        {
            get
            {
                return this._Id;
            }
            set
            {
                this._Id = value;
            }
        }
        
        private long _Tipodocumentoid;
        [Column("TIPO_DOCUMENTO_ID", OpenAccessType = OpenAccessType.Decimal, Length = 22, SqlType = "NUMBER")]
        [Storage("_Tipodocumentoid")]
        public virtual long TipoDocumentoIdProp
        {
            get
            {
                return this._Tipodocumentoid;
            }
            set
            {
                this._Tipodocumentoid = value;
            }
        }
        
        private string _Designacao;
        [Column("DESIGNACAO", OpenAccessType = OpenAccessType.Varchar, IsNullable = true, Length = 200, SqlType = "NVARCHAR2")]
        [Storage("_Designacao")]
        public virtual string DesignacaoProp
        {
            get
            {
                return this._Designacao;
            }
            set
            {
                this._Designacao = value;
            }
        }
        
        private short _Ficheiro;
        [Column("FICHEIRO", OpenAccessType = OpenAccessType.Decimal, Length = 1, SqlType = "NUMBER")]
        [Storage("_Ficheiro")]
        public virtual short FicheiroProp
        {
            get
            {
                return this._Ficheiro;
            }
            set
            {
                this._Ficheiro = value;
            }
        }
        
        private int? _Tamanhoficheiro;
        [Column("TAMANHO_FICHEIRO", OpenAccessType = OpenAccessType.Decimal, IsNullable = true, Length = 7, SqlType = "NUMBER")]
        [Storage("_Tamanhoficheiro")]
        public virtual int? TamanhoFicheiroProp
        {
            get
            {
                return this._Tamanhoficheiro;
            }
            set
            {
                this._Tamanhoficheiro = value;
            }
        }
        
        private string _Urlficheiro;
        [Column("URL_FICHEIRO", OpenAccessType = OpenAccessType.Varchar, IsNullable = true, Length = 1000, SqlType = "NVARCHAR2")]
        [Storage("_Urlficheiro")]
        public virtual string UrlFicheiroProp
        {
            get
            {
                return this._Urlficheiro;
            }
            set
            {
                this._Urlficheiro = value;
            }
        }
        
        private byte[] _Conteudo;
        [Column("CONTEUDO", OpenAccessType = OpenAccessType.Blob, IsNullable = true, SqlType = "BLOB")]
        [Storage("_Conteudo")]
        public virtual byte[] ConteudoProp
        {
            get
            {
                return this._Conteudo;
            }
            set
            {
                this._Conteudo = value;
            }
        }
        
        private short _Visivelreuniao;
        [Column("VISIVEL_REUNIAO", OpenAccessType = OpenAccessType.Decimal, Length = 1, SqlType = "NUMBER")]
        [Storage("_Visivelreuniao")]
        public virtual short VisivelReuniaoProp
        {
            get
            {
                return this._Visivelreuniao;
            }
            set
            {
                this._Visivelreuniao = value;
            }
        }
        
        private short _Sit;
        [Column("SIT", OpenAccessType = OpenAccessType.Decimal, Length = 1, SqlType = "NUMBER")]
        [Storage("_Sit")]
        public virtual short SitProp
        {
            get
            {
                return this._Sit;
            }
            set
            {
                this._Sit = value;
            }
        }
        
        private string _Insuser;
        [Column("INS_USER", OpenAccessType = OpenAccessType.Varchar, Length = 40, SqlType = "VARCHAR2")]
        [Storage("_Insuser")]
        public virtual string InsUserProp
        {
            get
            {
                return this._Insuser;
            }
            set
            {
                this._Insuser = value;
            }
        }
        
        private DateTime _Insdata;
        [Column("INS_DATA", OpenAccessType = OpenAccessType.Date, SqlType = "DATE")]
        [Storage("_Insdata")]
        public virtual DateTime InsDataProp
        {
            get
            {
                return this._Insdata;
            }
            set
            {
                this._Insdata = value;
            }
        }
        
        private string _Altuser;
        [Column("ALT_USER", OpenAccessType = OpenAccessType.Varchar, IsNullable = true, Length = 40, SqlType = "NVARCHAR2")]
        [Storage("_Altuser")]
        public virtual string AltUserProp
        {
            get
            {
                return this._Altuser;
            }
            set
            {
                this._Altuser = value;
            }
        }
        
        private DateTime? _Altdata;
        [Column("ALT_DATA", OpenAccessType = OpenAccessType.Date, IsNullable = true, SqlType = "DATE")]
        [Storage("_Altdata")]
        public virtual DateTime? AltDataProp
        {
            get
            {
                return this._Altdata;
            }
            set
            {
                this._Altdata = value;
            }
        }
        
        private short _Versao;
        [Column("VERSAO", OpenAccessType = OpenAccessType.Decimal, Length = 3, SqlType = "NUMBER")]
        [Storage("_Versao")]
        public virtual short VersaoProp
        {
            get
            {
                return this._Versao;
            }
            set
            {
                this._Versao = value;
            }
        }
        
        private string _Nomeoriginalficheiro;
        [Column("NOME_ORIGINAL_FICHEIRO", OpenAccessType = OpenAccessType.Varchar, IsNullable = true, Length = 100, SqlType = "NVARCHAR2")]
        [Storage("_Nomeoriginalficheiro")]
        public virtual string NomeOriginalFicheiroProp
        {
            get
            {
                return this._Nomeoriginalficheiro;
            }
            set
            {
                this._Nomeoriginalficheiro = value;
            }
        }
        
        private long _Assuntoid;
        [Column("ASSUNTO_ID", OpenAccessType = OpenAccessType.Decimal, Length = 22, SqlType = "NUMBER")]
        [Storage("_Assuntoid")]
        public virtual long AssuntoIdProp
        {
            get
            {
                return this._Assuntoid;
            }
            set
            {
                this._Assuntoid = value;
            }
        }
        
        private TiposDocumento _Tiposdocumento;
        [ForeignKeyAssociation(ConstraintName = "A_TD_FK", SharedFields = "TipoDocumentoIdProp", TargetFields = "IdProp")]
        [Storage("_Tiposdocumento")]
        public virtual TiposDocumento TiposdocumentoProp
        {
            get
            {
                return this._Tiposdocumento;
            }
            set
            {
                this._Tiposdocumento = value;
            }
        }
        
        private Assuntos _Assuntos;
        [ForeignKeyAssociation(ConstraintName = "A_ASS_FK", SharedFields = "AssuntoIdProp", TargetFields = "IdProp")]
        [Storage("_Assuntos")]
        public virtual Assuntos AssuntosProp
        {
            get
            {
                return this._Assuntos;
            }
            set
            {
                this._Assuntos = value;
            }
        }
        
        private IList<AnexosNotificacao> _Anexosnotificacaos = new List<AnexosNotificacao>();
        [Collection(InverseProperty = "AnexosProp")]
        [Storage("_Anexosnotificacaos")]
        public virtual IList<AnexosNotificacao> AnexosNotificacaos
        {
            get
            {
                return this._Anexosnotificacaos;
            }
        }
        [Telerik.OpenAccess.Transient()]
        private string _icone;

        [Telerik.OpenAccess.Transient()]
        private bool _seleccionado;

        //[FieldAlias("_icone")]
        public string Icone
        {
            get { return _icone; }
            set { _icone = value; }
        }
        //[FieldAlias("_seleccionado")]
        public bool Seleccionado
        {
            get { return _seleccionado; }
            set { _seleccionado = value; }
        }        
    }
}
0
PetarP
Telerik team
answered on 09 Nov 2011, 12:31 PM
Hello Manuel,

 I don't see nothing wrong with your code. Have you tried increasing the timeout period for your database? It is possible if two load operations overlap that one of them will wait for the other to finish and that might be longer then your timeout period.
You can open our model settings dialog and increase the timeout from there. Maybe that will fix the problem.

Best wishes,
Petar
the Telerik team

NEW and UPDATED OpenAccess ORM Resources. Check them out!

Tags
Databases and Data Types
Asked by
Manuel
Top achievements
Rank 1
Answers by
Ivailo
Telerik team
Manuel
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or