Add a column to a table Entity

Posts   
 
    
jeffsic
User
Posts: 5
Joined: 13-Feb-2006
# Posted on: 16-Feb-2006 00:16:37   

I am using adapater method with C#.

How would you add a column programatically to a table Entity?

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 16-Feb-2006 03:03:53   

You don't really add a column to an entity. You can create dynamic lists which can be created and manipulated dynamically. Post an example of what you are trying to accomplish and we'll be more specific in the answer.

jeffsic
User
Posts: 5
Joined: 13-Feb-2006
# Posted on: 16-Feb-2006 20:45:26   

I will try to give you an example of one of our application needs.

Lets say I have a SQL Table as follows

Item Description Cost

I would have 2 datagrids(?) on my screen. One at the top and one at the bottom of the screen. All the items are displayed in the top screen for the user to choice from. When they select an items, I want to tag the row they selected by setting a newly created field called, lets say, SelectedItem. This new field would not be in the actual database but would be created dynamically in my code.

Summary: What I think I want to do is create a collection instance. Create a new field for the collection. Fetch the collection and then allow me to set the newly created SelectedItem field.

This is just one example. They may be other ways to approach this which I would certainly listen to but if there is a way to add a temp field, I would love to know how to do this also.

Thanks Jeff

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 17-Feb-2006 03:11:36   

Well you could create two ProductCollections. One is fetched from the database. When one is selected from this collection it is then added to the other collections which is bound to the other grid, but is not fetched from the database. Are you using self-servicing or adapter? This is an example for self-servicing.

jeffsic
User
Posts: 5
Joined: 13-Feb-2006
# Posted on: 17-Feb-2006 15:11:07   

I am using C# and adapter method. I have to use adaptor method because I need to have the ability to change catalogs.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 17-Feb-2006 15:46:52   

I'm afraid I don't understand your example clearly. But I'll give you some hints about what I guessed this could be about.

First you can add a custom property to any of the genearted Entity classes (property that does not correspond to a field in the database)

Please refer to the LLBLGen Pro documentation "Using the generated code -> Adding your own code to the generated classes"

Also you can always get the selected rows from the datagrid, and hence get the Indexes of those rows and the cells included.