EntityFramework is open source:
[link:entityframework.codeplex.com]

But it turns out that SQL merge is more like upsert operation than pattern matching:

merge using [dbo].[myTable] on [myField] > 100
when matched then
--update/delete something
when not matched then
--insert something
;

Operation to do with match is update/delete/insert and not select.
The rule is matched against boolean (plus maybe extra conditions).

So this is not like F# or Haskell, etc. pattern matching. Real pattern matching would be more like some kind of select union. (Even if the output -syntax of the merge could be used to directly return something...)

By on 4/22/2013 2:43 AM ()

As David pointed out, Query Expressions are built on top of standard LINQ functions (IEnumerable and IQueryable). That way it can operate on objects and also on existing query providers (EF, Linq to SQL, MongoDB, etc.).

None of the known SQL query providers support merge, and AFAIK you can't extend their behaviors -- the last time I tried I ended up disassembling the binary, patching, re-signing its dependencies with a new SNK. Very ugly.

But if you could extend one of the existing providers, then you could implement support for merge command by inheriting from QueryBuilder class and extending it.

By on 4/18/2013 4:07 PM ()

What you want is quite elaborate. Unless I'm mistaken fslinq is built on top of existing Linq providers (Linq to SQL, EF Linq and therefore reuse their Expression Tree implementations) and they don't implement what you are looking for.

You'd probably have to roll your own with either Linq Expression tree or start entirely from scratch with query expression which is gonna be able to express more things with a desirable syntax.

By on 4/18/2013 3:14 PM ()

Doesn't seem that you have all the bits in an F# match construct that you would otherwise need to convert to a SQL merge, but perhaps I am missing something. Can you give an example ?

By on 4/18/2013 2:08 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper