Taiming the beast


Published: 2/11/2015, Author: Håkan Edling

I've been putting a lot of effort into the experimental vNext platform lately, but that doesn't mean that the good old Piranha isn't getting any love. Right now I'm focusing on Enity Framework, and I'd like to share why.

One of the drawbacks with the current architecture has for the last years been the data layer. It was originally written before Entity Framework code first was released, and has been slightly patched since then to keep up. The database has been created, and updated with raw SQL and this, together with multiple data mappings has complicated for people interested in collaborating on new features. With the next version I'm taking a first step to remedy this.

Meet EF code first migrations

The entire database has now been mapped with Entity Framework, as is, without additions or modifications. The next version will create it's database using Entity Framework and all future enhancements will be handled with migrations.

This unfortunately mean that you won't be able to update your existing database when upgrading to this version, it has to be created from scratch. However, since the database schema will be identical you will be able to simply copy the data from your old database to the new one after it's been created.

I'm really exited about this and truly believe this a key feature for bringing the framework forward.

Database support

Another great aspect to this is of course that Piranha CMS will be able to support all databases that is supported by Entity Framework, and if you're keeping up on what the people over at Microsoft are doing you know this means some pretty cool things in the future.

What's next?

After the setup process has been finalized this version will be released on NuGet. After that the focus will be on replacing all of the code using the old legacy mapping to use the new EF layer instead. This will be a painful and without a doubt boring task (honesty is a virtue) but as soon as this is done the fun part comes - moving the framework forward and improving the current data model :)


blog comments powered by Disqus