Skip to content

Database support in Thinktecture IdentityServer

January 28, 2013

This is post 1 in a short 3 part series on describing the database support in v2 of Thinktecture.IdentityServer. The parts of this series are:

  1. Database support in Thinktecture IdentityServer (this post).
  2. EF migrations in Thinktecture IdentityServer.
  3. Integrating Thinktecture IdentityServer database with an existing database.

In v2 of IdentityServer we used EntityFramework (EF) CodeFirst as our data access framework. What this means is that if your database supports EF then you can use it with IdentityServer.

In the default configuration of the code, we’ve configured the application to use a SqlServerCompact 4.0 database so that it’s dirt simple to download the code and get started. This database configuration is done via the ~/configuration/connectionStrings.config and it puts the database in ~/App_Data/IdentityServerConfiguration.sdf:

  <add name="IdentityServerConfiguration"
    connectionString="Data Source=|DataDirectory|\IdentityServerConfiguration.sdf"
    providerName="System.Data.SqlServerCe.4.0" />

There are other connection strings in this file (name=”SqlServer” and name=”SqlCe”), but they’re there for my convenience when doing database migrations (which I’ll comment on in the next post). If you’d like to remove them you can — they’re not used in any way at runtime.

So, if you’d like to use another database other than SqlServerCompact, then it’s just a matter of changing the connection string and provider name. This is all you’d need to do:

  <add name="IdentityServerConfiguration"
    providerName="System.Data.SqlClient" />

These connection strings I’ve shown do far are only for the IdentityServer configuration database and are separate from the user account database. If you’re using the membership provider for the account store then that will be configured separately as any other another other membership provider would be configured.


12 Comments leave one →
  1. Vijay permalink
    January 29, 2013 5:41 pm

    i am trying to use a custom user repository (database) that identityserver can validate users against. Will that be covered in your discussion?

  2. August 3, 2013 3:07 pm

    Does it support Amazon Dynamo DB if I want to store all my user info and config on that.

    • August 3, 2013 3:09 pm

      Don’t know — never tried that database.

      • anandkp permalink
        August 3, 2013 3:16 pm

        Any future plan for noSQl like amazon dynamodb?

        • August 4, 2013 12:01 am

          No plans for us to implement one, but the user DB and config DB are all modeled with interfaces, so you could always implement your own storage. Let me know how it goes.

  3. Sam permalink
    August 14, 2013 2:35 pm

    Good morning everyone,

    I’m new to IdentityServer and trying to setup the web.config for it.

    I’m trying to set it up to connect to Sql Server instead of Sql Server CE. at the bottom of the config, do i need the following element block?


    Can I leave this block out?

    If not, should it be the following since it is using entity framework code first?

    Thank you very much for your help on this

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: