Composite or Aggregate Objects Support?

Posts   
 
    
Posts: 3
Joined: 28-Nov-2007
# Posted on: 28-Nov-2007 16:06:22   

I've serached a bit here and I think I'd found that composite objects are not supported in the generated code.

I'm not sure if you call them composite or aggregate objects, but what I mean is:

I have a Customer table. I have an Order Table. They are related in the obvious way.

I'd normally make a CustomerAndOrders object that consisted of one Customer object and an IList which would hold orders. In my code, I would fill this object.

Now - Using LLBLGen code, I can envision how to do this, but is there something I should be looking at specifically for filling my objects? Do I need to look at the "Relations" objects?

Sorry if this is a remedial question, but there's a lot to the generated code that I would not normally have in my custom framework and I'm trying to sort out what's useful for my application.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 28-Nov-2007 16:37:45   

Using the SelfServicing model, if you fetch a Customer object, Customers.Orders collection will be fetched automatically for you when being accessed. (Lazy Loading / Load on Demand).

Using the Adapter model, you'd have either to fill the collection when needed, or use a PrefetchPath to fetch it upfront when fetching the Customer.

Note: you can also use PrefetchPaths to fetch such collection upfront in the SelfServicing model.

I'm not sure if I answered your question.

but you can also check the manual for the following: 1- Using the entity classes 2- Using the entity collection classes 3- PrefetchPaths

under "Using the generated Code -> Adapter/SelfServicing"

Posts: 3
Joined: 28-Nov-2007
# Posted on: 28-Nov-2007 17:03:55   

I think that is what I was looking for.

You did answer my question, too. I like that lazy loading thing, which is what I'd normally want, but I understand I'll have to go a little further because of the adapter method.

The PrefetchPath thing is the $$. That's exactly what I need to look at.

I figured that it was there, in some way. I appreciate you helping me find it quicker.

I have to tell you that LLBLGen is pretty awesome. I use a custom (1.1) framework built with CS templates that is beautifully crafted and I was leary of using using another framework. I've dabbled with Hibernate and Tiers and while they were good, LLBLGen spit out usable and intuitive code, right from the get go.

The documentation seems solid. I would have found my answer sometime, but I was able to do so much already without looking at the documentation, so I figured I'd ask simple_smile

There's so many other things that I'll need to get acquainted with, but the higher-ups have seen the app I made in a few hours and they like it and I just may be able to get out of writing and supporting our new 2.0-compliant framework, if all goes well.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39908
Joined: 17-Aug-2003
# Posted on: 28-Nov-2007 17:12:10   

Thanks Christopher simple_smile

Frans Bouma | Lead developer LLBLGen Pro
Posts: 3
Joined: 28-Nov-2007
# Posted on: 28-Nov-2007 21:35:56   

If this helps anyone out:

My "Composite Object", as gen'd by LLBLGen, is accessed a little differently than I thought, because it interpreted my xREF table as a connector to the collection.

IE:

I use the Adapter method...

I have an "Applications" table and a "Programmers" table - they are connected by a table called "ApplicationsAndProgrammers".

In short, what I did was to create the Application entity and FetchEntity() to fill it.

Then, I made an EntityCollection<ProgrammeEntity> and set it to = application.ProgrammersCollectionViaApplicationAndProgrammers

On my adapter, I used adapter.FetchEntityCollection and filled my objects.

This was great as I was making a simple master / detail page with fields at the top an a Grid for my related objects.

I didn't "have" to use PreFetch paths, as I started out. If you're filling a composite object that was created by the presence of having an xRef table, then those short lines of stuff worked great.



            DataAccessAdapter adapter = new DataAccessAdapter();
            
            ApplicationEntity application = new ApplicationEntity();

            application.Application = m_id; // my querystring value

            adapter.FetchEntity(application);
            
            BindFormToData(application); // my form binding method

            EntityCollection<ProgrammersEntity> programmers = application.ProgrammersCollectionViaProgrammersAndApplications;

            adapter.FetchEntityCollection(programmers, application.GetRelationInfoProgrammersCollectionViaProgrammersAndApplications());

            gvProgrammers.DataSource = programmers;

            gvProgrammers.DataBind();


So $$.. That's what I'd expect from a nice framework.. That's a very basic operation that most people would use and I'm glad to see that the xRef connector automagicially was there for me to use.

I never had the luxury of updating my collections easily, so I will check that out, too. I may be missing something even easier by not using the drag/drop stuff, but I'm not familiar with the drag/drop data stuff yet.

Thanks again.. I need to work on the Pluralization stuff and I also need to make some exps that can remove my field suffixes that I use on my tables.