Retrieve collection

Nov 10, 2008 at 5:28 PM

I just started working with your project and havent found issues so far and got up in running in a few hours.
However reading through the docs and trying, I am not able to retrieve a collection of entities?
What is the best way to do this.

Nov 10, 2008 at 5:39 PM

Hi Martin, you mean something like creating a filter criteria and retrieving the resulting set of entities from database?

If that's the case, Retina allows you to do it in a couple of ways. To start you should start looking into the Retrieve method in the ObjectContext class (the overload receiving a Criteria instance) and returns an EntitySet or Generic IList<T> collection.

This method loads all entities into memory (except for those lazy load entities & collections) but if you need a Reader semantics for long running processes the generic method RetrieveReader<T> is preferred.

Let me know if this is what are you looking for and I could post some sample code if you like.

Best regards,

Nov 10, 2008 at 6:52 PM
Hi Andres, this is where my problem is, i have used the Expression object instead of Criteria because im not having much luck at the moment.

I am indeed using the Retrieve method, however im just trying to receive the whole table (which is only 5 records or so).

Also do you plan on any docu around the Windows Forms classes that you have written? Or what do they do? Main part of my application is data entry/retrieval.

Nov 11, 2008 at 11:01 AM
Martin, here it is an example of how to retrieve a small table into memory (from the top of my head):

ObjectContext ctx = new ObjectContext();
IList<MyEntity> list = ctx.Retrieve( new Expression(typeof(MyEntity)) );
foreach( MyEntity e in list )
    // do something

The expression "Expression(typeof(MyEntity)) " is an empty criteria (Expression class derives from Criteria) and retrieves all rows for the "MyEntity" table.

The WinForms classes are UI helpers to build CRUD functionality. There are Web & Windows Forms support for this, and in the Test (EditTestForm & UserForm)  project you have a small glimpse of what they do and how they work.

Right now I'm focused on adding a couple more features I need for Retina, so documentation is not really a priority. Any help from the community here will be greatly appreciated.

Best regards,
Nov 11, 2008 at 11:28 AM
I would like to help, once I get the hang of it.
Do you have any examples on the forms part? Even a test program would help.

Nov 11, 2008 at 12:09 PM
Thanks very much for your time.
I will look into my samples and let you know asap. I have some samples for Win/Web forms but they probably need some facelifting.
Is there any website or email where I can post you this?
Thanks again,
Nov 11, 2008 at 12:52 PM
I dont want to paste my work email addie here right away.
I guess you can use both for msn or email.