linq to csla confusion

linq to csla confusion

Old forum URL: forums.lhotka.net/forums/t/8173.aspx


fsl posted on Wednesday, December 16, 2009

Hi

I'm using linq to sql for my dataportal implementation. I would like to use linq to query my business root objects. Should I just implement BuisnessListBase and I'm home free?

RockfordLhotka replied on Wednesday, December 16, 2009

It depends on what you want to do. You should read Chapter 14 of Expert 2008 Business Objects for a full understanding of L2C.

L2C is a minor extension of LINQ to Objects. It is not at all like LINQ to SQL.

fsl replied on Wednesday, December 16, 2009

Thank you for the quick reply.

What I'm essentially interested in is to build linq queries dynamically, using the properties of my business objects, and then later on retrieve the matching objects. I'm not sure whether csla gives me this for free.. (I'm assuming not).

RockfordLhotka replied on Wednesday, December 16, 2009

No that is not the way it works.

And in my view it should not work that way.

Good object models do not look like your database. Therefore it is
unrealistic to think that you can do a query over a good object model and
have any realistic mapping back to some relational data structure that is
entirely unlike your good object-oriented object structure.

ORM tools do this, because they help you create object models that look like
your database. They help you create relational object models. And that's
fine as a bridge between the OO and relational world, but it is a terrible
way to build your actual business layer...

fsl replied on Thursday, December 17, 2009

Thank you again for the reply. I agree.

Nevertheless, it puts me in a weird spot. I've used csla to abstract away the details of my database. Details which I now must reintroduce a dependence on, since I need search functionality in my application..

RockfordLhotka replied on Thursday, December 17, 2009

You probably don't want to do raw searches over entities (of any type - CSLA, EF, etc) for search. That'd be slow and really database intensive.

Generally speaking, search requires indexing to perform well and to not kill your database.

You might consider identifying the columns/entities you want to allow for search and create an index table in your database where those values are inserted/updated in parallel with the actual entity data in your more relational tables. That'd allow for much more efficient searching.

Copyright (c) Marimer LLC