CodeSmith Community
Your Code. Your Way. Faster!

Generating a big entity

Latest post 01-24-2008 6:20 AM by vbandrade. 2 replies.
  • 01-21-2008 5:11 AM

    • itai_mo
    • Not Ranked
    • Joined on 12-17-2006
    • Posts 2
    • Points 70

    Generating a big entity

    Hi,

     I am trying to improve performance of a big entity i have (simple select takes 8 seconds).

    It has too many fields (and some of it are very heavy) that I'm not using and I dont want to generate it.

    Is there any way to generate some of the fields and not all of it?

     

    thank's

    Itai

     

     

     

     

    • Post Points: 35
  • 01-21-2008 11:33 PM In reply to

    • SuperJeffe
    • Top 25 Contributor
    • Joined on 05-05-2006
    • Tulsa, Ok
    • Posts 390
    • Points 9,900

    Re: Generating a big entity

    Well, since you didn't put any numbers behind what you said....I will take a shot in the dark.  Please make sure you using the latest templates.  There was alot of optimizing done for large results sets a while back so please make sure if this first.

    If you are doing just selects, you could create a View and use that to do selects from.  If you are wanting to do Insert / Updates etc to the table, you would have to jump through hoops to get this to work good with a View.  You do not have the ability to save from a View.  You get back to either writing some custom procs to save from the View, or retrieving the entity in the end anyway to insert / update.  This could defeat the purpose of using the view if you have to retrieve in the end anyway.

    Also, if changing the data model is optional, you could move the unecesary columns to a one - one table.  I am not a big fan of one - one tables, but in this case I might think about it in order to optimize code.

    I think those are you options.  I am 98% sure that there is not a way to exclude columns from a table in Nettiers.  I think the above are you only options.

    Jeff

    ----------------------------------------------------------------------
     Member of the .NetTiers team | Visit http://www.nettiers.com
    ----------------------------------------------------------------------

    • Post Points: 35
  • 01-24-2008 6:20 AM In reply to

    • vbandrade
    • Top 25 Contributor
    • Joined on 09-27-2007
    • Brasil
    • Posts 249
    • Points 6,345

    Re: Generating a big entity

    You can also create a custom stored procedure.

    Say you have the following tableA and you wanto to ignore the colum Image, but still wanto to return the row/s as a NetTiers Entity

    TableA

    - IdA (Pk)
    - Name
    - Description
    - Image

    SELECT
        [IdA],
        [Name],
        [Description],  
        CAST(NULL AS Image) [Image]
    FROM
        [TableA]

     

    Be sure your fied allow nulls. And remember to use cast to the exact type of the column  you want to ignore.
    If your field doesn´t allow nulls justplace a '' instead of NULL

     

    SELECT
        [IdA],
        [Name],
        CAST ('' AS varchar(300) [Description],  
        CAST(NULL AS Image) [Image]
    FROM
        [TableA]

    • Post Points: 5
Page 1 of 1 (3 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems