Performance Question???

Posts   
 
    
Posts: 20
Joined: 23-Feb-2005
# Posted on: 28-Jun-2005 20:30:25   

What is the performance or difference between the two functions. (Or are they the same)


public Entity getEntityById(long Id)
{
    Entity entity = new Entity();
    if (!entity.FetchUsingPK(Id) ) 
    {   
    entity = null;
    }
    return entity
}

AND


public Entity getEntityById(long Id)
{
    Entity entity = new Entity(Id);
    if (entity.IsNew ) 
    {   
    entity = null;
    }
    return entity
}

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 28-Jun-2005 21:17:44   

Yes they're the same. FetchUsingPK is called frm the constructor in 2). simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 20
Joined: 23-Feb-2005
# Posted on: 29-Jun-2005 21:50:24   

Otis wrote:

Yes they're the same. FetchUsingPK is called frm the constructor in 2). simple_smile

Thanks. I was pretty sure that was going to be the answer. (Especialy when I went throught the code after posting the question). So basically whether to user form 1 or form 2 is a matter of style.

Rich