databinding in C# with paging and prefetch paths

Posts   
1  /  2
 
    
magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 30-Jan-2009 17:15:37   

I'm trying to understand how to successfully bind a LGP data source in C# (not within the .aspx file). I have my own GridView class and am overwriting the DataSource property with something like:


public override object DataSource
{
    get
    {
        return base.DataSource;
    }
    set
    {
        // bind the given datasource
        DataSource ds = (DataSource)value;
        //ds.EnablePaging = true;
        //ds.LivePersistence = false;

        base.DataSource = ds;

        try
        {
            base.DataBind();
        }
        catch (Exception ex)
        {
            throw new Exception(String.Format("Could not bind data to grid '{0}'.", base.ID), ex);
        }
    }
}

The given DS inherits from the LLBLGenProDataSource2 (could be based on a view, or on a table). It encapsulates information about the adapter, the namespace, etc. So I use it for example like this:


public class TeamSiListingDS : EntityDataSource, ISeasonalInstanceDS
{
    public TeamSiListingDS(SeasonEntity season)
        :
        base()
    {
        // set the name of underlying entity
        base.EntityName = "TeamSi";

        // set the prefetch path
        base.PrefetchPathToUse = getPrefetchPath();
    }

    public IPrefetchPath2 getPrefetchPath()
    {
        IPrefetchPath2 prefetch = new PrefetchPath2(EntityType.TeamSiEntity);
        prefetch.Add(TeamSiEntity.PrefetchPathTeam_);
        return prefetch;
    }
}

A specific data grid could look like this:


public class TeamSiListingGV : GridView
{
    public TeamSiListingGV()
        :
        base()
    {
        base.Columns.Add(new DataField("Team", "Team"));
        // base.Columns.Add(new DataField("Team_.Moniker", "Moniker"));

        base.DataSource = new TeamSiListingDS(null);
    }
}

Everything works fine, as long as I don't want paging and do not try to access fields of other entities (prefetched by the given path, like the "Team" entity).

I have tried to look through various posts here in the forum, but I couldn't figure out, what the solution to the problems is.

-) If I enable paging, I run into a NullReferenceException during the binding event. -) Same if I try to access fields of related entities the way I would access them if not working with a DS. The message is: "A field or property with the name 'Team_.Moniker' was not found on the selected data source."

Various posts in the forum refer to the idea that the LivePersistence should be set to false and/or the EntityCollection set manually. But when I set the LivePersistence to false, the grid is not generated at all. I also don't quite understand what is meant by "EntityCollection set manually".

I hope there is somebody out there who is not totally confused by my explanation. wink If not, then I would appreciate some questions to be able to go into the right direction of details.

Also a link to an example/tutorial how something like this is done properly would be great. Or a comment that it should not be done this way at all. In this case I would appreciate some hints how. wink

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 30-Jan-2009 19:40:16   

-) If I enable paging, I run into a NullReferenceException during the binding event. -) Same if I try to access fields of related entities the way I would access them if not working with a DS. The message is: "A field or property with the name 'Team_.Moniker' was not found on the selected data source."

Hi magic. Please post the exception info (exception message and stack trace). I guess you are using LivePersistence=true on the LLBLGenProDataSource, right?

David Elizondo | LLBLGen Support Team
magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 30-Jan-2009 20:07:31   

yes, I didn't change LivePersistence to false. Here are both stack traces.

1) Problem with field access -> "A field or property with the name 'Team_.Moniker' was not found on the selected data source."


   at System.Web.UI.WebControls.BoundField.GetValue(Control controlContainer)
   at System.Web.UI.WebControls.BoundField.OnDataBindField(Object sender, EventArgs e)
   at System.Web.UI.Control.OnDataBinding(EventArgs e)
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at System.Web.UI.Control.DataBind()
   at System.Web.UI.Control.DataBindChildren()
   at System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding)
   at System.Web.UI.Control.DataBind()
   at System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource)
   at System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at System.Web.UI.WebControls.GridView.DataBind()
   at Crez.Server.UI.Controls.GridViews.GridView.set_DataSource(Object value) in Server\UI\Controls\GridViews\GridView.cs:line 75

2) Problem with sorting: After setting these properties in GridViews.cs


base.AllowPaging = true;
base.PageSize = 10;
base.PagerSettings.FirstPageText = "First";
base.PagerSettings.LastPageText = "Last";
base.PagerSettings.Mode = PagerButtons.NumericFirstLast;
base.PagerSettings.Position = PagerPosition.Bottom;

-> "Object reference not set to an instance of an object."


   at System.Web.UI.WebControls.GridView.BuildCallbackArgument(Int32 pageIndex)
   at System.Web.UI.WebControls.GridView.CreateNumericPager(TableRow row, PagedDataSource pagedDataSource, Boolean addFirstLastPageButtons)
   at System.Web.UI.WebControls.GridView.InitializePager(GridViewRow row, Int32 columnSpan, PagedDataSource pagedDataSource)
   at System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource)
   at System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding)
   at System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data)
   at System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data)
   at System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback)
   at System.Web.UI.WebControls.DataBoundControl.PerformSelect()
   at System.Web.UI.WebControls.BaseDataBoundControl.DataBind()
   at System.Web.UI.WebControls.GridView.DataBind()
   at Crez.Server.UI.Controls.GridViews.GridView.set_DataSource(Object value) in Server\UI\Controls\GridViews\GridView.cs:line 75

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 01-Feb-2009 23:17:19   

From the error, it is kind of obvious to ask: Are you prefetching the Team_ -> Moniker path? At your getPrefetch method, you didn't add that node. Maybe at you grid you are referencing some field of the Moniker related entity, although you aren't prefetching it.

David Elizondo | LLBLGen Support Team
magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 02-Feb-2009 03:37:37   

daelmo wrote:

From the error, it is kind of obvious to ask: Are you prefetching the Team_ -> Moniker path? At your getPrefetch method, you didn't add that node. Maybe at you grid you are referencing some field of the Moniker related entity, although you aren't prefetching it.

erm ... I thought I did, but maybe I miss something here: Isn't the getPrefetchPath() method in the second piece of code in my initial posting prefetching the path?

And even with this question (possibly) solved: Do you see any reasons why the paging isn't working?

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Feb-2009 07:45:34   

magic wrote:

daelmo wrote:

From the error, it is kind of obvious to ask: Are you prefetching the Team_ -> Moniker path? At your getPrefetch method, you didn't add that node. Maybe at you grid you are referencing some field of the Moniker related entity, although you aren't prefetching it.

erm ... I thought I did, but maybe I miss something here: Isn't the getPrefetchPath() method in the second piece of code in my initial posting prefetching the path?

Mmm. no. You are prefetching this:

    public IPrefetchPath2 getPrefetchPath()
    {
        IPrefetchPath2 prefetch = new PrefetchPath2(EntityType.TeamSiEntity);
        prefetch.Add(TeamSiEntity.PrefetchPathTeam_);
        return prefetch;
    }

and my guess is that you should prefetch with the subpath:

    public IPrefetchPath2 getPrefetchPath()
    {
        IPrefetchPath2 prefetch = new PrefetchPath2(EntityType.TeamSiEntity);
        prefetch.Add(TeamSiEntity.PrefetchPathTeam_)
             .SubPath.Add(Team_Entity.PrefetchPathMoniker);
        return prefetch;
    }

magic wrote:

And even with this question (possibly) solved: Do you see any reasons why the paging isn't working?

I think that is related to the prefetchPath thing. So, lets solve the prefetchPath. If, after that, the paging problem persists, post some code where you sort. For example: Are you sorting based on the Grid columns or by code? Are you sorting on some related entity field?

David Elizondo | LLBLGen Support Team
magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 02-Feb-2009 13:17:08   

daelmo wrote:

and my guess is that you should prefetch with the subpath:

    public IPrefetchPath2 getPrefetchPath()
    {
        IPrefetchPath2 prefetch = new PrefetchPath2(EntityType.TeamSiEntity);
        prefetch.Add(TeamSiEntity.PrefetchPathTeam_)
             .SubPath.Add(Team_Entity.PrefetchPathMoniker);
        return prefetch;
    }

The "Moniker" is an attribute of the Team entity (translated by LGP to "Team_" because there is also an attribute/column in the TeamSi entity called "Team"). So I guess my prefetch path is correct, especially that this is working without any problems if used in another functionality where asp/web controls etc. are not involved.

daelmo wrote:

I think that is related to the prefetchPath thing. So, lets solve the prefetchPath. If, after that, the paging problem persists, post some code where you sort. For example: Are you sorting based on the Grid columns or by code? Are you sorting on some related entity field?

I must say that I didn't apply any sorting to the LGP data source so far. Might this be the problem? So ... no sorting & paging functionality => exception?

Is there no example/tutorial where all this would be shown?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 02-Feb-2009 15:02:38   

I think the prefetching is going fine. The problem is in databinding, as you can't dind a related entity's field as follows:

// base.Columns.Add(new DataField("Team_.Moniker", "Moniker"));

Better to use the Designer to create a field on related field, to have that Team.Moniker mapped to a field in the entity you are binding, so when you prefetch the Team related entity this field gets populated and hence usable in databinding.

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 04-Feb-2009 16:01:36   

Walaa wrote:

I think the prefetching is going fine. The problem is in databinding, as you can't dind a related entity's field as follows:

// base.Columns.Add(new DataField("Team_.Moniker", "Moniker"));

Better to use the Designer to create a field on related field, to have that Team.Moniker mapped to a field in the entity you are binding, so when you prefetch the Team related entity this field gets populated and hence usable in databinding.

1) Yes, the prefetching is going fine, but why is the binding not working? I thought I have seen some examples where this was done ... and if not, why is there no way to do it?

2) What would be the advantage of related fields against just creating views and having a data source based on the view?

The pain with this is still that I would have to create own structures (related fields, views, typed lists) for every single data source that I need, right? confused

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Feb-2009 16:53:17   

1) Yes, the prefetching is going fine, but why is the binding not working? I thought I have seen some examples where this was done ... and if not, why is there no way to do it?

Please check our ASP.NET databinding example posted in the download section of our website.

2) What would be the advantage of related fields against just creating views and having a data source based on the view?

In case you want the data of the main fetched entity to be editable (can be saved). As you can't save a TypedView or a TypedList (they are only used for Read-Only purposes).

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 04-Feb-2009 17:10:54   

Walaa wrote:

Please check our ASP.NET databinding example posted in the download section of our website.

I've checked out the examples (AdapterWebApp and AdapterWebApp2). Unfortunately all examples that I can find are of the same kind = definition of LGP DS in the aspx file and use of standard grid view. I don't have a problem with that. I can re-create this basic functionality with my project.

The problem that I have is that I want/have to extend basic GridView functionality. For this, I also have to extend BoundField and other controls. I would also like to work directly with the generated LGP entities and not indirectly address them by their names in the aspx code.

Walaa wrote:

In case you want the data of the main fetched entity to be editable (can be saved). As you can't save a TypedView or a TypedList (they are only used for Read-Only purposes).

For now I am only interested in data display. We collect the data on the client and want to show it on the server.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 04-Feb-2009 17:20:55   

For now I am only interested in data display. We collect the data on the client and want to show it on the server.

I think you mean collect data on the server and show it on the client. For that I recomment using flat lists (TypedList, TypedView or DynamicList).

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 04-Feb-2009 17:30:25   

Walaa wrote:

I think you mean collect data on the server and show it on the client.

erm ... nope. We have a client software that is installed on laptops. The users collect statistics with these clients and submit data on a game by game basis to the server. For now, we don't have to edit this data, we just want to show it.

Walaa wrote:

For that I recomment using flat lists (TypedList, TypedView or DynamicList).

ok, but I still don't understand why I can't have "dynamic" prefetches/joins between tables and views. For each GridView that I want to create, I will have to create an own database view or list? confused

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 05-Feb-2009 10:24:36   

ok, but I still don't understand why I can't have "dynamic" prefetches/joins between tables and views.

First of let's distinguish between Prefetches and Joins. Prefetches, fetches related entityies into the same graph containing the root/parent entity being fetched, so it doesn't perform a Join. And of-course you can dynamically do prefetches or Joins when fetching.

For each GridView that I want to create, I will have to create an own database view or list?

If you mean at Design time....you don't have to. As you can just use DynamicLists defined in code, and it would almost take the same effort it would take to define multiple prefetches, and databinding stuff.

In other words instead of creating queries which does prefetches, create those which fetch all fields in a flat list (dataTable).

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 05-Feb-2009 15:07:15   

Walaa wrote:

First of let's distinguish between Prefetches and Joins. Prefetches, fetches related entityies into the same graph containing the root/parent entity being fetched, so it doesn't perform a Join. And of-course you can dynamically do prefetches or Joins when fetching.

well ... I can set a prefetch path in the data source, but I can't access the columns that were prefetched from other entities ... can I?

Walaa wrote:

If you mean at Design time....you don't have to. As you can just use DynamicLists defined in code, and it would almost take the same effort it would take to define multiple prefetches, and databinding stuff.

In other words instead of creating queries which does prefetches, create those which fetch all fields in a flat list (dataTable).

well ... let's assume I have a table with player statistics of a game. I am aggregating (grouping) the table to show stats aggregated for a player for the whole season. In the view I am not joining the team or the player entity in. I might need both entities but most likely only one at a time. Always joining in both entities is a waste of time/resources.

My plan was to join the view with the needed table dynamically depending on which grid I want to display. Now it seems like I can't do this and I have to either join both entities into the view too, or make two views (one for each purpose). I'm not quite happy about this ...

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 06-Feb-2009 10:34:09   

well ... I can set a prefetch path in the data source, but I can't access the columns that were prefetched from other entities ... can I?

Yes you can. It was done in the ASP.NET 2.0 databinding example I refered to you.

My plan was to join the view with the needed table dynamically depending on which grid I want to display

That's a good reason to use a Dynamic List, where you can define fields from more than one table/view and the relations/Joins between them.

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 09-Feb-2009 17:24:38   

Walaa wrote:

well ... I can set a prefetch path in the data source, but I can't access the columns that were prefetched from other entities ... can I?

Yes you can. It was done in the ASP.NET 2.0 databinding example I refered to you.

My plan was to join the view with the needed table dynamically depending on which grid I want to display

That's a good reason to use a Dynamic List, where you can define fields from more than one table/view and the relations/Joins between them.

I spent quite a lot of time to try to understand this, and I must say that although I understand some parts of it now, I'm still far away from being happy about the possible solutions and having grasped the overall picture/solution. confused

First of all, I have done some more reading in the forum, and found this thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=11114

What I don't understand is the fact, that from the described example it seems to be somehow possible to access properties of other entities in a datasource based on an entity collection. So what am I doing wrong that I can't access the "Moniker" property? The relation between teamSi and team is a m:1 relation (1 teamSi --> 1 team).

Second, creating the DynamicList (new DataTable()) is quite a pain because I have to manually "copy"/define all fields of the "base entity" (or "base view"), although I know that I'm interested in all.

I'm also not sure whether I'm looking at the piece of code relevant for my problem in the mentioned tutorials (http://www.llblgen.com/pages/files/Example_WebDatabinding_06062008.zip). The code below is from "AdapterWebApp" / Products.designer.cs:


protected void ProductsDS_PerformSelect(object sender, SD.LLBLGen.Pro.ORMSupportClasses.PerformSelectEventArgs2 e)
{
    //Use a prefetchPath to Category, to display each Product's Category Name .
    PrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.ProductEntity);
    prefetchPath.Add(ProductEntity.PrefetchPathCategory);

    // build a list of fields to be execluded from the fetch.
    ExcludeIncludeFieldsList execludedFields = new ExcludeIncludeFieldsList(true);
    execludedFields.Add(ProductFields.UnitsInStock);
    execludedFields.Add(ProductFields.UnitsOnOrder);
    execludedFields.Add(ProductFields.ReorderLevel);
    execludedFields.Add(ProductFields.SupplierId);

    // use the DataAccessAdapter's FetchEntityCollection to fetch the contained collection
    // pass the filter and sorter passed in the PerformSelectEventArgs2
    // as well as the list of execluded fields.
    DataAccessAdapter adapter = new DataAccessAdapter();
    adapter.FetchEntityCollection(e.ContainedCollection, e.Filter, e.MaxNumberOfItemsToReturn, e.Sorter, prefetchPath, execludedFields, e.PageNumber, e.PageSize);      
}

Do you mean that if I would add the prefetch path to the TeamEntity in a method overriding the PerformSelect method, I could then access the Moniker attribute? I don't understand how this would make a difference / be different from specifying the PrefetchPathToUser property ...

I also still don't understand why I can't find any examples of creating a LGP-DataSource for a GridView completely without defining it in the .aspx file ...

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 10-Feb-2009 08:46:06   

Walaa wrote:

well ... I can set a prefetch path in the data source, but I can't access the columns that were prefetched from other entities ... can I?

Yes you can. It was done in the ASP.NET 2.0 databinding example I refered to you

I told you, you can access related entities' fields, and that the ASP.NET 2.0 databinding example has samples for it.

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 10-Feb-2009 14:58:41   

Walaa wrote:

Walaa wrote:

well ... I can set a prefetch path in the data source, but I can't access the columns that were prefetched from other entities ... can I?

Yes you can. It was done in the ASP.NET 2.0 databinding example I refered to you

I told you, you can access related entities' fields, and that the ASP.NET 2.0 databinding example has samples for it.

I'm sorry, I don't see where and how this is done. That's why I asked in the previous post whether you can point me to the piece of code, or maybe at least the file where this is done. If you don't have time, please at least tell me for which key words I should search the solution.

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Feb-2009 21:20:44   

This section of the documentation descibes how to add a field to an entity to access the value of a field on a related entity.

Once this field has been generated into the entity code it can be bound like any other entity field - the only caveat to remember is that the related entity that the field refers to has to be exist in the graph with the parent entity.

Matt

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 10-Feb-2009 22:08:05   

MTrinder wrote:

This section of the documentation descibes how to add a field to an entity to access the value of a field on a related entity.

Once this field has been generated into the entity code it can be bound like any other entity field - the only caveat to remember is that the related entity that the field refers to has to be exist in the graph with the parent entity.

Matt

thank you for the link. I'm starting to feel more and more like a dumbo confused ... I still don't get the overall picture:

-) What do you mean by "in the graph with the parent entity?" -) If I specify to add the field as described by you (shown in the tutorial), do I still have to use the prefetch path? I assume no, and that the bound attribute will be automatically fetched, right? -) How do the previously mentioned dynamic lists fit into this scenario?

Although I now know how to "fix the problem" in various ways, I'm still not really happy about the solution(s) because it still means that I have to address every possible display scenario used in a gridview "in advance". Meaning I can't just go ahead and join two tables (a table and a view etc.) "on runtime" = without creating a view, a list, or create associations in the LGP project in advance. confused

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Feb-2009 22:20:25   

1) Let's take Customer-Order as it is the usual standard. Say you added the customer name field to the Order as described in the instructions. This would allow you to bind "Order.CustomerName" as you require. However, for this to return a value, the Customer entity needs to have been fetched as well as the Order entity - this is what "in the graph" means - a related entity loaded in memory.

this brings us to

2) Sorry, wrong simple_smile You need to have fetched the Customer entity yourself by specifying the pre-fetch path at load time - Adapter performs NO lazy loading so it is your job to make sure that the data is there.

3) Give me 10 minutes to read back through and I'll get back to you...!

Matt

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Feb-2009 22:28:25   

Sorry, I'm having problems following the thread of this thread simple_smile What is it that you are trying to acheive using dynamic lists, that hasn't been addressed by the ability to access/bind a related field on an entity...?

Matt

magic
User
Posts: 125
Joined: 24-Nov-2008
# Posted on: 10-Feb-2009 22:39:41   

MTrinder wrote:

Sorry, I'm having problems following the thread of this thread simple_smile What is it that you are trying to acheive using dynamic lists, that hasn't been addressed by the ability to access/bind a related field on an entity...?

thanks for the answers to (1) and (2). I'm starting to see the light at the end of the tunnel ... and it doesn't look like a train. wink

What I'm trying to achieve is a completely "dynamic" data source for a grid view. Basically basing a GridView on a db view without having to really create a view in the database.

So for example ... I start out with the OrderEntity (to stick to your example). If I want a GridView that shows more details about the CustomerEntity, I "join in" the customer. If I want to have more details about the product ordered, I "join in" the ProductEntity, or maybe also the "ProductCategory" entity.

I might need such views depending on how I look at the order, from a "customer's perspective", or from a "product's perspective" etc.

I know I can do this by creating a TypedList, a TypedView, or the solution mentioned by you, but do I really have to? I'd love to live/work without it.

Did I make the confusion perfect? wink

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Feb-2009 22:59:55   

Dynamic Lists are the way to go. They avoid you having to create views in the database, or TypedLists or TypedViews in the LLBLGen designer.

Think of them as a DB view which can be defined in code as and when needed - they can do pretty much everything that you can do, including joining information from more than one table (using relations already defined in the LLBLGen designer, or dynamic ones that you create your self), aggregates, filtering etc.

I just want to make sure that you have the distinction between Entities and DynamicLists straight ? And that pre-fetch paths and related fields are only used with entities? In your scenario, where you are display information from many tables in a read-only grid, dynamic lists are the better solution.

Matt

1  /  2