What is the right level of maturity

In my previous blog post I explained about the Data Storage Maturity Model and how you would get a much more mature and capable application if you used Event Sourcing. That blog post did bring up some interesting question.   Should I always use Event Sourcing? Given that Event Sourcing was at the top of the pyramid you could conclude that you should always aim for the the top and use Event Sourcing. Aiming high is a noble cause and sounds like the right thing but it turns out that it isn’t that simple. If your application is relative simple … Continue reading What is the right level of maturity

Data Storage Maturity Model

There are many ways of storing data when developing applications, some more mature and capable than others. Storing data of some sort or another in an application is common. Extremely common to be exact as almost every application out there needs to store data is some way or another. After all even a game usually stores the users achievements. But it’s not games I am interested in. Sure they are interesting to develop and play but most developers I know are busy developing line of business (LOB) applications of some sort or another. One thing line of business application have … Continue reading Data Storage Maturity Model

Using optimistic concurrency with RavenDB

Whatever database your are using, relational or document, there is one thing you can be certain of as soon as you get a second user of the system and that is concurrency conflicts. It may not happen often but eventually it will happen that two users load the same document, make some changes to it and save it back to the database. There are several ways of dealing with these kind of concurrency problems: Just ignoring it and letting the second users changes overwrite the first ones While this isn’t advisable if the data is very important there are lots … Continue reading Using optimistic concurrency with RavenDB

Paging through data in RavenDB

RavenDB has a very nice feature in it being safe by default and returns just 128 documents. Now you can override these safe defaults but it is very unwise to do so. And even if you decide to do so are you really going to show a million customers to your user at the same time? I would guess not as the user would not be really happy with the response or the speed of it. In most cases using paging is a much better solution.   Paging through a RavenDB result set It turns out that paging through a … Continue reading Paging through data in RavenDB

Storing and retrieving records using RavenDB

After installing RavenDB 2 the next step is to start saving data and load it again. Unlike SQL server we don’t need to go into the RavenDB Management Studio and create a database and tables with a schema. The database, optional but highly recommended, will be created when we first access it. And when it comes down to tables and schema RavenDB is much simpler, all it does is store documents. A document doesn’t have a schema enforced so we don’t need to define one up front. Instead we just save some data and load it again. The document to … Continue reading Storing and retrieving records using RavenDB

Installing RavenDB 2

Before we get started with RavenDB we need to install the required parts. There are several ways we can do this and one of the easiest is using the NuGet Package manager from within Visual Studio 2012 with the available RavenDB NuGet packages.   Which package to install? As should be obvious from the screenshot above there are quite a few NuGet packages to choose from. It turns out we need to use two packages to get started, the client and server part. Adding them is easy, just open the NuGet Package Manager Console window from the Visual Studio Tools … Continue reading Installing RavenDB 2

Querying RavenDB databases

As we have seen in previous blog posts getting data from a RavenDB database is easy. Either use the IDocumentSession.Query<T>() function to load a series of documents or the IDocumentSession..Load<T>() function to load a document using its identity. However sometimes we want more control over what we want to load. It turns out this is rather easy as the IDocumentSession.Query<T>() function returns an IQueryable<T>, actually it returns a IRavenQueryable<T> to be exact but more about that another time. Querying the database As IDocumentSession.Query<T>() return an IQueryable<T> we can just start composing queries just as we can with EntityFramework or another … Continue reading Querying RavenDB databases

Using RavenDB with Azure websites

In a previous post I explored various options of hosting RavenDB. While using RavenDB as a Windows Service or hosted in IIS is probably the best way to go in most cases there are a number of cases where the embedded option is great. And one of the places where I really like the embedded option of hosting RavenDB is when doing simple standalone websites. And with the new Azure website option that is a great way to host them.   The code is real straightforward and just like before. I am using a DataDirectory option when creating the EmbeddableDocumentStore … Continue reading Using RavenDB with Azure websites

Different options for hosting RavenDB

In the previous blog posts about RavenDB I used the Raven.Server.exe to create a database server. Just running raven.Server.exe and connecting to it is fine for development but certainly not our only option.   Running RavenDB as a Windows Service Once you have the RavenDB.Server NuGet package you can install it as a Windows Service. This means it is always available and running whenever you need it. Certainly a nice and simple way of using RavenDB if you do so more often.   Installing is easy, just run Raven.Server.exe /install and it installs.   Running as an IIS application Another … Continue reading Different options for hosting RavenDB

RavenDB and multiple databases

In my previous two posts about RavenDB I used a Book class as the example. The first example was an ASP.NET MVC 3 application and the second was an ASP.NET MVC 4 application and I just copies the Books class from the first to the second example. As I just used the default namespace in both projects .NET would consider this two different classes, after all the namespace and assemblies are different.   How does RavenDB handle CLR types It turns out RavenDB doesn’t really care about these differences with namespaces and assemblies. The extra information is stored as metadata … Continue reading RavenDB and multiple databases