Help in selecting specific column from an entity

Posts   
 
    
Austinn
User
Posts: 38
Joined: 25-Aug-2008
# Posted on: 25-Dec-2009 23:58:47   

Hello I am new bie, trying to understand from the help file but will take some time to eat these things.

Ok. I have generated the code successfully using self service. Now In my data base there is a table city and LLBGen pro generated different City classes. Now the problem is that how can I retrevie only the selected column from this table. Like I want to generate only CityId, and CityName and do not want to generated other columns is there any simple way to do it in the code side, instead of creating a view and then using it.

Yes after this I need to create a hasTable of the returned object is it possible too...

this is what i am trying to do

 CityCollection city = new CityCollection();
            city.GetMulti(null);

I know it is a basic question. Plz accept appology as I am new to this puzzle...

Thanks and regards Austinn

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Dec-2009 05:13:18   

Hi Austinn

I don't know exactly what you mean by "generate some columns". Let me explain the possibilities:

A. You could Edit the entity at LLBLGen Pro Designer and remove some columns you don't want to generate in your code. That means that the entity will have just some columns. For instance, consider the following table:

Customer

CustomerId CustomerName Phone PetName

Now, you don't want to use the PetName field at your code, you can remove it. That means that you wont be able to access it at your code.

B. You can Include/Exclude fields in the fetch action. For example, you can map all the fields from your table to the entity so they all are available at your code, but you just want to fetch some fields, you can use this option. That means that the entity will have all the fields but just some of them will be filled.

C. If you just want a list of objects that contains just a couple of fields you can use TypedViews, TypedLists or DynamicLists. Please read the manual from the links I posted to understand the differences.

So, it's up to you, just confirm what you are trying to achieve. Hope helpful wink

David Elizondo | LLBLGen Support Team
Austinn
User
Posts: 38
Joined: 25-Aug-2008
# Posted on: 26-Dec-2009 05:50:24   

Thanks Daelmo, Appreicate your response. I am trying for Option B from but I am unable to see ExcludeIncludeFieldsList excludedFields = new ExcludeIncludeFieldsList();

This class is not appearing in the IDE at all. Am I missing something...?

Regards Austinn

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Dec-2009 09:40:36   

You need to include a reference to LLBLGen Pro ORM Support Classes then include a _using _statement in you code file:

using SD.LLBLGen.Pro.ORMSupportClasses;
David Elizondo | LLBLGen Support Team