Linq to LLBLGen and TypedViews

Posts   
 
    
jbreuer
User
Posts: 43
Joined: 30-Nov-2009
# Posted on: 30-Nov-2009 14:35:23   

Hello,

Is it possible to use TypedViews the same way as normal entities and collections in Linq to LLBLGen?

The following example is a normal entity and collection:


LinqMetaData MetaData = new LinqMetaData();
var q = (
                        from p in MetaData.ProductGroup
                        where p.Nivo == 1
                        select p
                    );
            return ((ILLBLGenProQuery)q).Execute<ProductGroupCollection>();

Is it possible to make something like that using a typed view?

I've got the following typed view: VwInternetArtikelenToceloTypedView and the following row: VwInternetArtikelenToceloRow.

Now I'd like to have something like this:


var q = (
                        from p in MetaData.VwInternetArtikelenToceloTypedView
                        where p.Nivo == 1
                        select p
                    );

            return q.ToList<VwInternetArtikelenToceloRow>();

I don't know if this is possible and if not is there another good solution to use a typed view with Linq to LLBLGen?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 30-Nov-2009 16:17:51   

Linq-2-LLBLGen is only for EntityCollection

But you can map any database view to an entity. ref: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15160

jbreuer
User
Posts: 43
Joined: 30-Nov-2009
# Posted on: 30-Nov-2009 16:23:39   

Walaa wrote:

Linq-2-LLBLGen is only for EntityCollection

But you can map any database view to an entity. ref: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=15160

Thanks for the info! Is there a tutorial how I can map a view to an entity?

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 30-Nov-2009 16:29:46   

Just right click on the Entities node in the Designer Objects tree, and select "Add New Entities Mapped on Views from Catalog(s)" Ctrl+Shift+V

jbreuer
User
Posts: 43
Joined: 30-Nov-2009
# Posted on: 30-Nov-2009 16:51:36   

Once again thank you! I love how Linq to LLBLGen works simple_smile .