InitClassEmpty blues

Posts   
 
    
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 01-Nov-2005 21:17:56   

Hello Frans.

I'm revisiting a problem that I've mentioned before. Perhaps you can help.

Using Adapter and October 6th Beta of 1.0.2005.1. Using VS.Net 2005.

In my application, a pre-generated collection entity is bound to a grid.

This code generated the data graph:

public EntityCollection GetCatalogueCategories()
{
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.CatalogueCategoryEntity);
prefetchPath.Add(CatalogueCategoryEntity.PrefetchPathCatalogueCategoryDetail);
EntityCollection lst = new EntityCollection(new CatalogueCategoryEntityFactory());
ISortExpression sorter = new SortExpression(SortClauseFactory.Create(CatalogueCategoryFieldIndex.Description, SortOperator.Ascending));
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(lst, null, 0, sorter, prefetchPath);
return lst;
}

The data is bound to the grid:

bindingSourceTabs.DataSource = Categories.Items ;

Changing the row on the grid triggers this grid event:

private void grdViewTabs_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
bindingSourceDetail.DataSource = ((CatalogueCategoryEntity)CurrentEntity()).CatalogueCategoryDetail.Items;
}

Interestingly, this method alone calls the InitClassEmpty event (for CatalogueCategoryDetailEntity !??!!) which is a follows:

For CatalogueCategoryDetailEntity....

protected virtual void InitClassEmpty(IValidator validator, IEntityFields2 fields)
{
    InitClassMembers();
    base.Fields = fields;
    base.IsNew=true;
    base.Validator = validator;

        
    // __LLBLGENPRO_USER_CODE_REGION_START InitClassEmpty
    if (fields.State == EntityState.New)
    {
        CategoryType = 1;
    }
                // __LLBLGENPRO_USER_CODE_REGION_END
}

As I step through the code, I see that fields.State == EntityState.New.

It's confusing to me that the child InitClassEmpty method is called at all. All we're doing is attaching one of the parent's collections (CatalogueCategoryDetails) to a datasource. It's even more confusing that the state is found to be EntityState.New. Hence, CategoryType is always set to new, even though the child entities are pre-fetched.

This is proving difficult to de-bug. Any ideas on how I can track down the problem?

Thank.

Jeff

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 01-Nov-2005 21:35:06   

Please try with the final, a beta of october 6 is pretty old. A lot of things have been fixed since then.

Frans Bouma | Lead developer LLBLGen Pro
Jeff M
User
Posts: 250
Joined: 04-Aug-2004
# Posted on: 02-Nov-2005 22:05:00   

Otis wrote:

Please try with the final, a beta of october 6 is pretty old. A lot of things have been fixed since then.

I sure will. I'd like to look into this "About LLBLGen Pro" box that I've heard so much about anyway.

Jeff

P.S. What better commentary about the quality of your support than to say that an October 6th beta is "pretty old".

Amazing!

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39933
Joined: 17-Aug-2003
# Posted on: 03-Nov-2005 12:03:42   

Jeff wrote:

Otis wrote:

Please try with the final, a beta of october 6 is pretty old. A lot of things have been fixed since then.

P.S. What better commentary about the quality of your support than to say that an October 6th beta is "pretty old". Amazing!

simple_smile Well... you can look at it from different angles. wink You can also say: "you needed that much releases during such a short period?" (even though it was in the middle of the beta period with a new release almost every day). We have a release often policy also because I really can't stand it when there's a bug found in the code, I want to fix it a.s.a.p., so not a lot of customers run into it. simple_smile

Frans Bouma | Lead developer LLBLGen Pro