Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Issue with DDS setup



I am working on a POC with Dynamic data saving and retrieving and have followed the below article. . Howe

I get Object variable not set error while saving a new record on the line .

var store = DynamicDataStoreFactory.Instance.CreateStore(typeof (Comment));

Not sure if I am missing anything in the config file or an initialization module.This is what I have in the config: Can someone point me what am I missing.

Note: I am doing this in a class library so that I can reference it later in web project if we decide on going with DDS.

<?xml version="1.0" encoding="utf-8"?>
<section name="episerver.dataStore" type="EPiServer.Data.Configuration.EPiServerDataStoreSection, EPiServer.Data" />
<!-- For more information on Entity Framework configuration, visit -->
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity name="EPiServer.Framework" publicKeyToken="8fe83dea738b45b7" culture="neutral" />
<bindingRedirect oldVersion="" newVersion="" />
<assemblyIdentity name="EPiServer.Licensing" publicKeyToken="8fe83dea738b45b7" culture="neutral" />
<bindingRedirect oldVersion="" newVersion="" />
<assemblyIdentity name="EPiServer.Data" publicKeyToken="8fe83dea738b45b7" culture="neutral" />
<bindingRedirect oldVersion="" newVersion="" />
<dataStore defaultProvider="EPiServerSQLServerDataStoreProvider">
<clear />
<add name="EPiServerSQLServerDataStoreProvider" description="SQL Server implementation of Data Store" type="EPiServer.Data.Dynamic.Providers.SqlServerDataStoreProvider, EPiServer.Data" connectionStringName="EPiServerDB" />
<cache defaultProvider="nullCacheProvider">
<add name="httpCacheProvider" description="Http Cache implementation for DataStore" type="EPiServer.Data.Cache.HttpRuntimeCacheProvider,EPiServer.Data.Cache" />
<add name="nullCacheProvider" description="Null Cache implementation for DataStore" type="EPiServer.Data.Cache.NullCacheProvider,EPiServer.Data" />
<clear />
<add name="EPiServerDB" connectionString="Server=localhost;Database=dbname; User ID=sa;Password=;Connection Timeout=60;Integrated Security=false;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />


Oct 03, 2019 20:51

What version of Episerver CMS are you using?

Try adding this attribute to your Comment class:

[EPiServerDataStore(AutomaticallyCreateStore = true, AutomaticallyRemapStore = true)]
public class Comment : IDynamicData
      // Required to implement IDynamicData
      public Identity Id { get; set; }
      // Save datetime comment was created
      public DateTime DateTime { get; set; }
      // Save pageID of page on which comment was created.
      public int PageID { get; set; }
      // Save name of person who commented
      public string Name { get; set; }
      // Holds the actual comment
      public string Text { get; set; } 


var store = DynamicDataStoreFactory.InstanceGetOrCreateStore(typeof(Comment));

var comment = new Comment();
// Initialize comment, make sure the Id property are set.


Oct 04, 2019 7:42

Hi Dileep,

As you are using a different class library project so make sure your DB context is initialized properly before you perform any operation.

You can refer an article here-


Ravindra S. Rathore

Oct 07, 2019 8:29

Thanks for the information. However with same code used inside the application was working fine so I have left it for now. I believe it could be because of DB initializarion but couldnt find out what was wrong.

Oct 21, 2019 20:24
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.