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 along with the book data but only the actual class name, Book in this case, is used as the type discriminator. The screenshot below shows the metadata of one of the books I created using the original MVC3 application.
However when I started the second MVC4 application all 5 of the previously created books just appeared, even though the Book class in that application used a different namespace. And I could edit and save them without any problems. This did change the metadata to display the new namespace as shown in the screenshot below.
The important thing to remember here is that RavenDB just cares about our class name and will just use the data. In this case not much of a problem but that will not always be the case.
Using multiple database
The solution is the same as with SQL Server, just create multiple database to separate data from different application. Now you can go into the RavenDB management studio and create a new database there.
That works just fine But you can do it even easier. Just specify the database name in the connection string. In that case RavenDB automatically used that database for all operations and if it doesn’t exist yet it will be created as needed.
Deleting old databases
Once that is done I can locate the actual folder on disk and delete it.