What are the viable alternatives to Typed Views when using EF4 templates?

Posts   
 
    
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 02-Mar-2012 02:02:31   

I have some views in SQL Server. I am using entity framework 4 generated by LLBLGen.

Should I create stored procedures and code generate those OR Should I create typed lists, thus mimicking what I am already doing in the views?

Thanks in advance

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 02-Mar-2012 06:31:01   

Devildog74 wrote:

Should I create stored procedures and code generate those OR Should I create typed lists, thus mimicking what I am already doing in the views?

Both are valid. LLBLGen Designer for EF supports TypedViews mapped onto SPs and "Entities" mapped onto DB views under certain conditions.

So the question is: ¿what is more suitable in your case? If you can't make some field as identifying field on the view, then you can't use entities, then go for SP's.

Using TypedLists is also an option but maybe you can't mimic all views as some could be kind of complex SQL.

David Elizondo | LLBLGen Support Team
Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 02-Mar-2012 06:50:04   

Ok, thanks. In my case, using a typed view mapped onto a SP is most approriate.

However, regarding your statement "If you can't make some field as identifying field on the view" is there a way to make a field "identifying" on the view?

I cannot add a PK to a view in SQL Server can I? I am using SQL 2k8 R2 and SQL Azure... I dont think I can add a PK to a view...

In the LLBLGen designer, am I allowed to reverse engineer a view into an entity and then use the designer to set the identifying field on the entity via the designer? Am I missing a feature? Just curious.

Devildog74
User
Posts: 719
Joined: 04-Feb-2004
# Posted on: 02-Mar-2012 06:52:10   

oops, disregard... I think I will give this a shot -> "under certain conditions"