[CLOSED] v2.0 Store with linq anonymous type

Page 1 of 2 12 LastLast
  1. #1

    [CLOSED] v2.0 Store with linq anonymous type

    Hi, in the 2.0 i have a problem with the Store binding in very slow whit the anonymous type, in V1.2 it's work ok.

    This is very slow and retrive an error comunication failure when StoreComuni.databind(), the query work ok;

     var lstcomuni =
                    from t0 in database.CAPCOM
                    where (t0.CapComCom.StartsWith(pIniText))
                    select new
                    {
                        t0.CapComId,
                        t0.CapComCod,
                        t0.CapComCom
                    };
                   StoreComuni.DataSource = lstcomuni;
                    StoreComuni.DataBind();
    This work ok, but select all the field from table:
     var lstcomuni =
                    from t0 in database.CAPCOM
                    where (t0.CapComCom.StartsWith(pIniText))
                    select (t0);
                    StoreComuni.DataSource = lstcomuni;
                    StoreComuni.DataBind();
    The table content 10.000 record and is filter average 200 - 300 record for query.

    If define a Classe with the 3 field, it's work ok, the problem is the anonymous type..

    Tanks

    Aurelio
    Last edited by Daniil; Mar 12, 2012 at 11:34 AM. Reason: [CLOSED]
  2. #2
    Can you prepare test sample? Instead SQL please use some memory data (for example, collection)
  3. #3
    Hi, Vladimir, I'm investigating why when public the application on the web server, it works, but with visual studio in mode dedugging it's report error. I try to make a new database to see if the problem is here. Prepare a sample with data in memory to see if the problem persists.

    Thanks

    Aurelio
  4. #4
    Hi,

    Sometimes I face such issue when VisualStudio launches an application very slow in debug mode.

    Removing all breakpoints may help:
    VS Main Menu => Tools => Delete All Breakpoints.
  5. #5
    Hi, i have reply the problem:

    Web page:
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="ARWebRevolution.WebForm1" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Ext.NET v2 Example</title>
     
    </head>
    <body>
        <form id="Form1" runat="server">
        <ext:ResourceManager ID="ResourceManager1" runat="server">
        </ext:ResourceManager>
          <ext:Store ID="Store1" runat="server" >
                <Model>
                    <ext:Model ID="Model1" runat="server" IDProperty="nome">
                        <Fields>
                            <ext:ModelField Name="nome" />
                            <ext:ModelField Name="rata" />
                            <ext:ModelField Name="costo" />                        
                        </Fields>
                    </ext:Model>
                </Model>    
                <Sorters>
                    <ext:DataSorter Property="nome" />
                </Sorters>        
            </ext:Store>       
             <ext:Viewport ID="Viewport1" runat="server" Layout="border">
            <Items>
                <ext:Panel ID="PanelNazioni" runat="server" Region="West" Width="300" BodyPadding="3"
                    Layout="FitLayout" >
                    <Items>
                      <ext:GridPanel ID="GridPanelProvince" runat="server" Title="Province" StoreID="Store1">
                            <ColumnModel>
                                <Columns>                            
                                    <ext:Column runat="server" ID="nome" DataIndex="nome" Align="Left" Text="Nome" Flex="1"/>
                                    <ext:Column runat="server" ID="Rata" DataIndex="rata"  Text="Rata" Width="50"  />
                                    <ext:Column runat="server" ID="Costo" DataIndex="costo"  Text="Costo" Width="50"  />
                                </Columns>
                            </ColumnModel>
                           
                        </ext:GridPanel>       
                    </Items>
                </ext:Panel>
                 <ext:FormPanel ID="FormPanelNazione" runat="server" ButtonAlign="Right" Height="185"
                    BodyPadding="10" Padding="3"  Region="Center" Title="Nazioni...">                  
                </ext:FormPanel>
            </Items>
        </ext:Viewport>     
        </form>
    </body>
    </html>
    Code page:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using ARWebRevolution.Query;
    using Ext.Net;
    
    namespace ARWebRevolution
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            
            protected void Page_Load(object sender, EventArgs e)
            {
                var lista = TestData(50);
                var lista2 = from t0 in lista
                             select new
                                        {
                                            t0.nome,
                                            t0.rata,
                                            t0.costo
                                        };
                Store1.DataSource = lista2;
                Store1.DataBind();
            }
    
          
    
            private static List<Employee> TestData(int count)
            {
                var firstNames = new string[] { "Ed", "Tommy", "Aaron", "Abe", "Jamie", "Adam", "Dave", "David", "Jay", "Nicolas", "Nige" };
                var lastNames = new string[] { "Spencer", "Maintz", "Conran", "Elias", "Avins", "Mishcon", "Kaneda", "Davis", "Robinson", "Ferrero", "White" };
                var ratings = new int[] { 1, 2, 3, 4, 5 };
                var salaries = new int[] { 100, 400, 900, 1500, 1000000 };
    
               var data = new List<Employee>();
                var rnd = new Random();
    
                for (int i = 0; i < count; i++)
                {
                    var ratingId = rnd.Next(ratings.Length);
                    var salaryId = rnd.Next(salaries.Length);
                    var firstNameId = rnd.Next(firstNames.Length);
                    var lastNameId = rnd.Next(lastNames.Length);
    
                    var rating = ratings[ratingId];
                    var salary = salaries[salaryId];
                    var name = String.Format("{0} {1}", firstNames[firstNameId], lastNames[lastNameId]);
                    var rowEmp = new Employee{nome = name,rata = rating,costo = salary};
                    data.Add(rowEmp);
    
                }
    
                return data;
            }
    
            public class Employee
            {
                public string nome { get; set; }
                public int rata { get; set; }
                public int costo { get; set; }
            }
        }
    }
    Visual studio modal debug with anonymous type query
    1)Load 50 record it's work OK
    2)Load 100 record it's not work error Internet Explorer: impossibile visualizzare la pagina Web

    Visual studio modal debug not anonymous:
     protected void Page_Load(object sender, EventArgs e)
            {
                var lista = TestData(1000);
                var lista2 = from t0 in lista
                             select (t0);
                Store1.DataSource = lista2;
                Store1.DataBind();
            }
    1)With 1000-2000 record it's work OK

    In V1.2 anonymous work ok

    Tanks
    Aurelio
  6. #6
    I tried with 100 and 1000 records and don't see any problems (test sample with anonymous type)
    On my computer, the page with 1000 records is rendered in 0.138 ms

    Try to use VS2010 profiler to determine bottle neck
  7. #7
    Hi, Vladimir, the problem is my VS2010 debugger, VS2010 profiler execute the page and work ok, but in modal debug it's not work, V1.2 work ok, now investigate for my VS2010 debug.

    The problem is my VS2010, close the post.

    Thanks

    Aurelio
  8. #8
    Please clarify did you try this?

    Quote Originally Posted by Daniil View Post
    Removing all breakpoints may help:
    VS Main Menu => Tools => Delete All Breakpoints.
  9. #9
    HI, Daniil, i have delete all breakpoint and execute many other setting on debugger options, but the problem persist, with 1.2v work ok, now i have install vs2011 beta, but i have the same problem, in modal debug the STORE1.databind() is slow and the page non loaded and retrive an error to IE. It's work ok without debugging (CTRL+F5).

    Tanks
    Aurelio
  10. #10
    Ok, thanks for the details.

    Unfortunately, we have no more idea what might be wrong.
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 3
    Last Post: Jul 02, 2012, 8:27 AM
  2. Replies: 7
    Last Post: Jun 03, 2011, 9:18 PM
  3. Replies: 12
    Last Post: May 17, 2011, 7:08 AM
  4. [CLOSED] Binary Type in Store
    By majestic in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 29, 2010, 9:33 AM
  5. Store Sort Type not working
    By bobs in forum 1.x Help
    Replies: 2
    Last Post: Feb 10, 2009, 9:01 AM

Posting Permissions