Bring Back Rows a Table

Posts   
 
    
Posts: 15
Joined: 13-Mar-2011
# Posted on: 14-Mar-2011 06:18:38   

Hi,

I've been reading the documentation for 3.1 (targeting llblgen framework) for a day and a half and still have not found an example of the simplest possible scenario - retrieve all the rows and all the fields in a table. The ORM equivalent of a simple SELECT * FROM ...

I'm using the Adapter as distinct from Self Servicing.

Can someone please direct me to an example that uses this. Being the easiest place to start, I'd like to start there and then get more complex (filters, grouping). I just don't want to put the cart before the horse.

Thanks

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 14-Mar-2011 10:37:37   

Assuming the entity you are dealing with is CustomerEntity:

var customes = new EntityCollection<CustomerEntity>();
using(var adapter = new DataAccessAdapter())
{
   adapter.FetchEntityCollection(customers, null)
}
Posts: 15
Joined: 13-Mar-2011
# Posted on: 15-Mar-2011 05:24:07   

Thanks Walaa,

I also finally stumbled across this as:


        public EntityView2<ProductEntity> GetProducts()
        {
            EntityCollection<ProductEntity> products = new EntityCollection<ProductEntity>(new ProductEntityFactory());
            EntityView2<ProductEntity> productsView = null;

            using (DataAccessAdapter productsAdapter = DataAccess.AdaptorFactory.GetNewAdaptor(true))
            {

                productsAdapter.FetchEntityCollection(products, null);
                productsView = new EntityView2<ProductEntity>(products);
            }

            return productsView;
        }

I will try out your code too.

As feedback to the documenter, it would have been easier for me if there was a simple example somewhere early in the documentation. Start simple. Throw the newbie a bone. Then, I can start considering PredicateBuckets etc.