Tag Archives: Databases in general

Entity Framework is open source, why not SqlClient?

If you’re watching at least a little what’s going on in .NET world you noticed that Entity Framework is open source for couple months now. That’s a good thing.

On the other had there are still some pieces of the complete stack that are not open source. The one that I’m missing most is SqlClient. I’m writing provider for Firebird and although the MSDN documentation contains a lot of content sometimes it’s not obvious how things should behave. Then the SqlClient‘s behavior is (at least by me) taken as de-facto standard. I think everybody expects behavior that adheres to it. Over the last few years I’ve spent maybe thousands of hours trying things with SqlClient and ILDASM-ing into internals. But it could be easier if you could just step into the code and see the behavior, variables, … Also other people might look at the code and instead of just reporting bug posting also related info where to find the proper implementation or how it differs internally.

I wish to go back to this post in the foreseeable future and happily strike-though the complete text and just say that SqlClient is open source too.

Custom transactions in Entity Framework 6

Entity Framework 6 will come with a nice feature of being able to use custom transactions. You can either manually start new one with some isolation level (in fact this was possible even before, just little bit more code) or – and this is really nice, because I had questions about this (and did some custom hacks in Firebird’s provider) couple of times. So I like it. And I like it also because finally the transactions are (at least in my eyes) of same importance as connections (where the support was good before).

There’s one thing, I think, that will make it even better. Something like “transaction factory”. The motivation behind is, that you often need to have a specific set up for the transactions and use it always (with maybe few exceptions). The UseTransaction method seems to have one drawback: you need to access the connection (that means either from context or from other place where you stored it) and start the transaction. Later commit or rollback it. You can do it easily for SaveChanges/SaveChangesAsync. But for queries? You’ll need to create and use your own plumbing/infrastructure throughout the code. But adding some point, where you can plug in (and also though resolver/configuration), might make it very easy.

// i.e. Func<DbConnection, DbTransaction>
dbContextInstance.TransactionFactory = connection => (connection as MyDbConnection).BeginTransaction(/* some crazy setup */);  // MyDbConnection is the actual store connection

Of course, you might say: “And who is going to commit/rollback it?”. You might opt-in for default behavior – no error = commit, rollback else. Or handle it manually in some OnCommit/OnRollback events (or factory again to make it more enterprise-ish 8-)).

Anyway I don’t want to discuss all the details of actual implementation or how it aligns to current state. Just a opinion and high level overview of my thoughts.

If you might have questions or need some examples or motivations, let me know in comments. I have handful of these.

NuoDB has new (web-based) management console

I don’t know whether you noticed, NuoDB is now in RC stage. If you’re following NuoDB long enough you might remember old console (you can check some images in my older post). It was a Java based application. Simple and it was not nice. Now it’s different. It’s web based. So it’s easier to connect to it. You can even connect to it from your phone (if it’s powerful enough to handle the JavaScript). It’s way nicer, nothing fancy (but I’m not expecting to be super cool, it’s basically admin panel for database, right?) and mainly, it has tons of new features.

After you log in, you see (initially) basic screen about your (now) so called domain.

Probably first thing you’ll try is starting new database. Simple wizard will allow you to do this. Here’s final screen before starting it up.

You can then see how is your database doing. Transaction nodes, storage nodes, memory etc.

You can even see some graphs about what’s going on (it’s live updated).

Very important for your database is keeping everything smooth and cleanly running. And if something goes wrong (or actually seems to be going wrong), act. In the new console you can set up alerts based on different events or metrics and browse these for investigation, for example.

You know I said I’m considering it being admin panel for database. Plain simple is OK for me. If I’m using it often enough my muscle memory learns the moves and I can get my information quickly whenever it is. Sometimes it takes little it longer, but hopefully we’re not doing this admin stuff often. But the new web console allows you customize some views to your needs, hence you can have all your information in front of you on few screens. You can show different views, organize these or collapse some. Some views are even parametrized, i.e. by database.

I like the new console. With the old one I was more happy with the command line and doing everything manually. With the new one I’m doing more and more stuff in it, especially if trying something.

I know I promised blog post about using NuoDB in cloud (Amazon EC2/Amazon S3), but still busy to prepare it completely. :\

ADO.NET provider for Firebird 3.0.1 released

Few weeks ago the 3.0.0 version was released (actually it was during Firebird Conference 2012, during my talk ;) ) and it came with some new features and improvements (hence version 3.0.0). And as it goes, nothing is perfect and few items slipped through testing phase. So that’s th reason why today, I’m happy to announce version 3.0.1 to be released.

You can download it from NuGet or from Firebird SQL site as it gets updated.

This release contains fixes for two regressions introduced in 3.0.0. You can see both in tracker. It’s also my initial step to release these small bugfix releases more often (as discussed in list).

Go grab it, while it’s hot.

ADO.NET provider 3.0.0 for Firebird and DDEX provider 3.0.0 for Firebird released

I’m pleased to announce version 3.0.0 of ADO.NET provider for Firebird and version 3.0.0 of DDEX provider for Firebird. ADO.NET provider 3.0.0 comes with couple of bug fixes and two major improvements.

  1. Changed transaction isolation modes
  2. New installer that updates machine.config

You can read more about the first at DNET-337. Basically now ReadCommitted and ReadUncommited are same. And using (among others) FbTransactionBehavior.RecVersion/isc_tpb_rec_version. That should better match the default behavior a lot of people is expecting.

The new MSI installer now not only installs all the necessary files, but also updates machine.config file and registers the assembly into GAC (you can select not to do it). So after full install, you don’t have to do anything. You’re just ready to go.

The rest of changes can be seen in tracker log for this version.

The DDEX provider 3.0.0 comes with new installer as well. Now when you do the install, the DDEX provider is fully registered into Visual Studio (you can select version(s) during install) and ready to go as well. No need to fiddle with registry or any other files.

Hope you’ll enjoy these improvements.