The name DbType does not exist in the current context

I have installed the Orchard CMS in WebMatrix and was creating a new module. When I came to the migration file, I got the following error:

The name DbType does not exist in the current context

The following includes had been automatically added to the migration file by the Orchard Code Generator:

using System;
using System.Collections.Generic;
using System.Data;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData.Builders;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;

This actually looked good since DbType is defined in System.Data. The problem was just that the using was there but the reference to the System.Data framework assembly was missing. So I just right-clicked on my Orchard CMS website in Visual Studio and selected “Add reference…”. You then see a dialog where you can choose Assemblies > Framework on the left hand side and then select the checkbox next to System.Data in the middle pane. Then press OK and the errors are gone !

Leave a Reply

Your email address will not be published. Required fields are marked *