New Entity Tries To LazyLoad Fields

Posts   
 
    
hylegoz
User
Posts: 10
Joined: 11-Jul-2008
# Posted on: 25-Jul-2008 14:38:10   

Hi,

When I create a new instance of AEntity and try to reach a.B property that related to a BEntity instance, a Sql query executed at Sql server like this:

AEntity a = new AEntity();
Console.WriteLine(a.B.Name);
select [dbo].[B].[ID], [dbo].[B].[A_ID], [dbo].[B].[Name] from [dbo].[B] where [dbo].[B].[A_ID] = 0

The AEntity instance is new, there is no way to find any related BEntity at database, but it still tries. How can I stop that?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 25-Jul-2008 21:05:36   

What LLBLGenPro version and RunTimeLibraries version are you using ?

Read this explanation about lazy loading and the documentation.

(Edit)

I suppose a.B is an Entity, right?

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39866
Joined: 17-Aug-2003
# Posted on: 26-Jul-2008 10:57:22   

We didn't post a guidelines thread in every forum: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=7722

Please follow these steps, we don't have your code in front of us.

Frans Bouma | Lead developer LLBLGen Pro