Folks, I have a simple ISAM data source which can get-by-key or seek on
arbitrary indexes. I'm only using an Int32 primary key at the moment and
haven't needed to create more indexes so far. For a few thousand records
the performance is good, but as it grows and you ask for something like
this:

var smiths = mydb.List<Customer>().Where(c => c.Surname =
"Smith").OrderBy(c => c.Postcode);

It slows because this query inefficiently "Lists" the complete database
over the primary Int32 index and then uses LINQ-to-objects to give me the
result. In this case it's no better than reading a txt file.

I realised of course that the real solution is to make my data source a
LINQ Provider that it can use its internal DB smarts to answer queries
efficiently. By looking at these articles: *Walkthrough: Creating an
IQueryable LINQ Provider
<http://msdn.microsoft.com/en-us/library/vstudio/bb546158(v=vs.110).aspx>*
and *Enabling a Data Source for LINQ Querying
<http://msdn.microsoft.com/en-us/library/bb882640.aspx>* I realised I was
up for a full-time specialist job for a few months. The latter page
describes how you can decide to make a *simple*, *medium* or *complex*
provider and it warns: "Developing a complex provider requires a
significant amount of effort". After reading about expression trees I
realise this is a highly specialised and complex topic. Even Oren who
created RavenDB says it took him longer to write the LINQ provider for the
database than it took to write the database itself, which is pretty
sobering!

I'd still like to turn my data source into a *simple* LINQ provider if
possible, but lord knows where to start, maybe at the huge walkthrough in
my first link. I found re-linq <https://relinq.codeplex.com/> which
apparently takes some of the pain of working with expression trees, but I
haven't even found a tutorial on it yet.

Has anyone got experience or comments on this subject?

*Greg K*

Reply via email to