POCO linq to sql

Posts   
 
    
fromrus
User
Posts: 2
Joined: 23-Jun-2010
# Posted on: 23-Jun-2010 10:01:15   

Hello! Is there any way to archieve poco with linq to sql with llbgen?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 23-Jun-2010 10:51:17   

You can use Linq-2-LLBLGen, and project into POCOs. e.g.

var query = from c in metaData.Customer
                            select new CustomerPOCO
                                     {
                                         Name = c.Name,
                                         City = c.City,
                                     };

Is this what you have in mind?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 23-Jun-2010 11:07:53   

fromrus wrote:

Hello! Is there any way to archieve poco with linq to sql with llbgen?

You mean, writing your own entity classes and use a .xml file for the mappings? For v3, we support Linq to sql and Xml mapping files and POCO classes are generated (no base class), though the entity classes still rely on Linq to sql core code. Doing Poco with linq to sql is somewhat possible although it quickly runs into problems as linq to sql doesn't use proxies.

Frans Bouma | Lead developer LLBLGen Pro
fromrus
User
Posts: 2
Joined: 23-Jun-2010
# Posted on: 23-Jun-2010 13:48:16   

ive tried to generate some entities for northwind db but they'r not so different from orcas designer.I mean i just want get rid of all useless generated code and get mappings only with lazy load. Nothing more. If its possible where can i find a tutorial for this?

And sorry for offtop but is there any way to auto sync my server db with dbm file without regenerating it?

Thanks...

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39903
Joined: 17-Aug-2003
# Posted on: 23-Jun-2010 16:52:35   

fromrus wrote:

ive tried to generate some entities for northwind db but they'r not so different from orcas designer.I mean i just want get rid of all useless generated code and get mappings only with lazy load. Nothing more. If its possible where can i find a tutorial for this?

Linq to sql supports lazy loading through EntitySet and EntityRef instances so what we generate. The extra code in the generated classes is indeed close to what vs.net generates too but it's mainly code that helps you working with the entities in various environments, and really it's not in your way, as the code generated is in partial classes you don't have to look at. I don't see the advantage of NOT having that extra code in your classes.

And sorry for offtop but is there any way to auto sync my server db with dbm file without regenerating it? Thanks...

LLBLGen Pro doesn't generate a dbml file for linq to sql and every time you refresh the catalog with your db, you have to regenerate code to reflect the changes.

Frans Bouma | Lead developer LLBLGen Pro