Checking usage of an entity.

Posts   
 
    
Darren166
User
Posts: 41
Joined: 30-Jan-2007
# Posted on: 08-Mar-2007 04:16:24   

I am using .net 2, self servicing, llblgen v2.

I have created a simple page for editing lookup tables in my database. It consists of a dropdown list of tables and a grid. I have a datasource control driving the grid. The dropdown list dynamically sets the datasource control to the appropriate entity and the grid is rebound. This way I can view any table in the database that I have entered the info for in the dropdown list. I can also edit and delete the fields.

What I would really like is a way to display usage info on fields, so that for instance when the grid is displaying info from the 'colour' table, a button on each row would fire up a new grid showing what products were using that value. I have many other tables that may be using colour, but they all link back to products.

The generated code contains all the info for relationships, but is there any way I can utilise this in a generic fashion to determine where a particular entity is being used?

The only info i have at code level is the datasource control for the entity being edited. I know there are methods available (GetDependingRelatedEntities etc) for finding this out, but they only work if you have prefetched the data and I do not know what data to prefetch as the entity is dynamic.

I hope I have made this clear!

It would be great if there were some way to generate a query that returned a list of entities that utilised the particular row in my entity I am interested in.

Any help from anyone?

Thanks,

Darren

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 08-Mar-2007 05:39:23   

The dropdown list dynamically sets the datasource control to the appropriate entity and the grid is rebound.

Using the same technique you can set another dataSource and bind it to another grid, using SelectParameters you can filter rows displayed on the second grid upon the Selected Colour (for example) from the main Grid.

It's a typical Master-Detail databinding scenario.