Search code examples
.netclrrdbmsobject-oriented-database

Was anyone thinking of 'CLR Server' instead 'SQL Server'?


I was thinking many times, now days that we have Linq and other CLR language-specific built-in search, sort and other capabilities over tables, collections and object, why not have the 'SQL Server' or rather call it 'CLR Server' (not only OOP Server but CLR 3.5) which will be a CLR (or COM) DLL that exposes the data allowing users linqing right over it; this will save much of cuncurrency pain, time of developing in two different language and so on. I am not saying (god forbid) throw away SQL, it just crosses my mind to many times, I thought let's hear what the community has to say about.

This idea is not completely new of course, there is such (different than my idea tho) a DB in FoxPro. But I am talking about a pure CLR .NET 3.5+ DB that will allow external accessing the DLL, should not even generate SQL Queries, the whole system should work differently.

There should be additional Linq keywords for insert update and delete but they should all be 'Linq style'.

I am 100% sure that Microsoft have been thinking about this before maybe they had performance considerations and more IDK, let me hear your opinions, I personally think that today with .NET 3.5-4.0 if we will have collection handling, Extension methods etc. in the server treating all the data as object it might be really cool (regarding coding, again, donno what about performance).

Whatcha say? I hope this question was asked in the right place, please accept my apology in advance, if it does not belong to here, please comment and I will delete it.

Sorry for this poor example, but please get the idea:

Module Module1

    Sub Main()
        ClrServer.MyDataBase.ObjectContext.MyTables.Add(New ClrServer.MyDataBase.MyTable)
        Try
            ClrServer.MyDataBase.SaveChanges()
        Catch e As ClrServer.UpdateException
        End Try

        Dim x = From a In ClrServer.MyDataBase.ObjectContext.MyTables Where a IsNot Nothing
        Dim y = From a In ClrServer.MyDataBase.ObjectContext.MyOtherTables Where a IsNot Nothing
        Dim z = From a In ClrServer.MyDataBase.ObjectContext.MyFreakingTables Where a IsNot Nothing

        'So far no access to server made, the local maintainer hold up the request
        'Connection to server is going to be made in the next line
        'and previous 3 queries will be loaded then.
        ClrServer.MyDataBase.ObjectContext.Execute()
    End Sub

End Module

'This is server side code, there should be internal ways to connect to real data when executing.
Namespace ClrServer
    Namespace MyDataBase
        Public Class MyTable

        End Class


        Module ObjectContext
            Public MyTables As List(Of MyTable)
            Public Sub SaveChanges()

            End Sub
        End Module
    End Namespace
End Namespace

We could then import the namespaces and use the ObjectContext inline. Please do not say "bad code" cuz it is bad code, I only wrote a poor pseude example right in the Stackoverflow WYSIWYG editor just for you to see what I mean.


Solution

  • You are describing an Object Database. Here's one:

    db4o C# Database

    • Native to .NET 2 and 3.5 (including the Compact Framework)
    • 100% Object Oriented Database, no object-relational mapping
    • Designed for embedded use in zero-admin environments
    • Open source and free under the GPL

    http://www.db4o.com/s/csharpdb.aspx