Store Procedure Projections

Posts   
 
    
Posts: 72
Joined: 11-Aug-2006
# Posted on: 04-Mar-2008 02:04:51   

Hi

I'm trying to find a good example using the ConverttoProjectors Method on a stored procedure. I can't seem to get it to work. Using Adapter, ASP.Net 2.0 , LLBL 2.5

Creating EntityPropertyProjector instances for all entity fields. Sometimes you want to project all fields of a given entity and it can be cumbersome to create a lot of EntityPropertyProjector objects if your entity has a lot of fields. Instead, you can use the shortcut method on EntityFields2: EntityFields2.ConvertToProjectors( EntityFieldsFactory.CreateEntityFieldsObject(EntityType.entitynameEntity))

Can you help? I have been searching the docs but it looks like a "leate breaking" with 2.5

thanks! Marty

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 04-Mar-2008 02:58:01   

Hi Marty.

ConvertToProjector return EntityPropertyProjector objects. Resulset projections (stored procedures, for example) use DataValueProjector objects. You can read the docs about Resulset projections.

Hope helpful

David Elizondo | LLBLGen Support Team
Posts: 72
Joined: 11-Aug-2006
# Posted on: 04-Mar-2008 03:48:28   

daelmo wrote:

Hi Marty.

ConvertToProjector return EntityPropertyProjector objects. Resulset projections (stored procedures, for example) use DataValueProjector objects. You can read the docs about Resulset projections.

Hope helpful

Hi maybe I'm getting confused. A New Feature ( listed below ) says it is supposed to be easier to do projections but there are no examples. I have spent a number of hours reading about resultset projections but I can't find a good example of this feature nor how to implement it. Help! confused

EntityFields(2) classes now have a static (shared) method which creates a new list of EntityPropertyProjector instances with the fields of the EntityFields(2) object passed in. This makes it easier to create projections for entities.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 04-Mar-2008 10:36:17   

ConvertToProjectors maybe used to project from an entityCollection's entityView, to a databale, another entityCollection or a collection of a custom class instances.

But you want to convert the resultSet of a storedProcedure call to an entityCollection which is a different thing, and ConvertToProjectors should not be used here.

Please check the following manual's section: Using the generated code -> Adapter/SelfServicing -> Fetching DataReaders and projections

Posts: 72
Joined: 11-Aug-2006
# Posted on: 04-Mar-2008 22:08:57   

Walaa wrote:

ConvertToProjectors maybe used to project from an entityCollection's entityView, to a databale, another entityCollection or a collection of a custom class instances.

But you want to convert the resultSet of a storedProcedure call to an entityCollection which is a different thing, and ConvertToProjectors should not be used here.

Please check the following manual's section: Using the generated code -> Adapter/SelfServicing -> Fetching DataReaders and projections

Thanks waala. What I was trying to do was put the entitycollection as a select statement at the end of the stored procedure to save a round trip to the DB. I'm thinking with the extra code it's probably quicker to just send another request to get the entity collection after running the SP?