Fetch Entity

Posts   
 
    
shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 17-May-2010 13:15:42   

I am trying fetch entity from a class file. Here is my code

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms;

using ClubCentricHelper.DatabaseSpecific; using ClubCentricHelper.EntityClasses; using ClubCentricHelper.FactoryClasses; using ClubCentricHelper.HelperClasses; using SD.LLBLGen.Pro.ORMSupportClasses;

namespace ClubCentricBISpecific { public class StateTable { EntityCollection<StateEntity> state = new EntityCollection<StateEntity>(new StateEntityFactory()); private DataAccessAdapter adapter = new DataAccessAdapter();

}

}

I am not able to execute adapter.fetchentity and assign it to dataset. What am I doing wrong here ? Am i missing any refernces? I dont get the fetchentity option itself

Regards, Shekar

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 17-May-2010 15:41:53   

I am not able to execute adapter.fetchentity and assign it to dataset. What am I doing wrong here ? Am i missing any refernces? I dont get the fetchentity option itself

Where is the fetching code?

Maybe you need to use adapter.FetchEntityCollection(); if you are fetching into the state collection.

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 17-May-2010 16:28:16   

Well that is the problem I am facing

Am not able to type adapter.FetchEntityCollection();

When I start typing ada.... it does not display adapter at all. even if i type adapter. then fetchentitycollection is not getting displayed

Shekar

Walaa avatar
Walaa
Support Team
Posts: 14994
Joined: 21-Aug-2005
# Posted on: 17-May-2010 18:11:09   

Sometimes Intellisense gets stuck, but if you typed it manually would it compile?

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 17-May-2010 18:38:25   

No I tried typing manually also. It just does not work

shekar

miloszes
User
Posts: 222
Joined: 03-Apr-2007
# Posted on: 17-May-2010 20:16:22   

shekar wrote:

namespace ClubCentricBISpecific { public class StateTable { EntityCollection<StateEntity> state = new EntityCollection<StateEntity>(new StateEntityFactory()); private DataAccessAdapter adapter = new DataAccessAdapter();

}

}

Maybe it is a silly question, but did you typed it inside a method? I don't see any method in the mentioned code.

Regards, MiloszeS

shekar
User
Posts: 327
Joined: 26-Mar-2010
# Posted on: 18-May-2010 06:09:52   

I think you were right. My new code is as shown below. What I am trying to do is get the list of all country names and filter it by FLAG=0 and then bind it to dataset. what should I write in place of "("CHOPS");" What should be actual code here ?

public static DataSet GetCountry() // Retrive country.description { try {

            var adapter = new DataAccessAdapter();
            var customer = new CountryEntity("CHOPS");
            adapter.FetchEntity(customer);
            DataSet ds = adapter.FetchEntity(customer);
            return ds;
        }
        catch (Exception ex)
        {
            return null; //throw (ex);

        }
    }
daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 18-May-2010 06:27:23   

Hi there. We can post all the code here, but I think would be helpful for you to read the following manual sections: - Entity retrieval into entity collection object and then, - Projection data inside EntityView2 on another structure, which will you help passing the filled entity collection into a dataTable.

As you want the final result as a DataTable, you also should read Using dynamic lists.

Please back here with your final code and let us know if you need further help.

David Elizondo | LLBLGen Support Team