evendotnet / Even

An event sourcing framework on top of Akka.NET
134 stars 29 forks source link

Create an Oracle Persistence provider for Even #9

Open DamianReeves opened 8 years ago

DamianReeves commented 8 years ago

I'm going to attempt to create an Oracle persistence provider/plugin for Even.

What is the desired model for persistence providers, a separate project, like the Even.MySql project or all in one solution?

nvivo commented 8 years ago

I believe it will be easier to have this in a separated project for now.

nvivo commented 8 years ago

@DamianReeves

Ho Ho Ho! Take a look at Even.Persistence.Sql I just implemented. You should be able to extend the new BaseSqlStore now. That should make your life much easier to get this started.

DamianReeves commented 8 years ago

Thanks, will take a look.

DamianReeves commented 8 years ago

I like the idea of using the ADO.NET provider model to make the persistence layer easy to use. I have to do some added work since I'm not directly linking in the Oracle binaries. I'm trying to avoid reflection when dealing with the OracleBlob type needed to store payload and metadata, so I'm looking at using System.Expression to access provider specific types directly from the provider agnostic Even.Persistence.Sql project.

nvivo commented 8 years ago

I never used oracle, so I don't know exactly the differences in the provider space, but I don't think it would be bad to reference ODP directly. The reason I created a single project for SQL and MySQL is because 1) I'm lazy and I didn't want to have to publish multiple packages, and 2) because mostly they work the same using only the abstract System.Data classes.

But this is not something I'm content with. To detect duplicate key violations with mysql, I'm checking for the exception message instead of the error code which could be done if I had access to the MySqlException class.

So, I wouldn't be afraid of creating a dedicated package and depending directly on the oracle provider. I think we need to test some concepts, it's too soon to settle on a format for these things.

DamianReeves commented 8 years ago

Sometime today or tomorrow I'll push up changes to my fork, some code might help you see what's involved. Overall though a common thing is cases where you need a provider specific DbType enum. For instance, in Oracle I need a blob column since varbinary doesn't exist and DbType.Binary doesn't properly map to blob.