November Happy Hour will be moved to Thursday December 5th.

Using Dynamic Data Store in Class Library | Database instance not created

Vote:
 

Hi Team,

We are creating a custom class library away from episerver site to be consumed by webapi. Webapi will be exposed to be used by episerver site to fetch information from class library and many other places.

We decided to use Dynamic data store to store objects in class library to be used on episerver pages. While doing so, we created Models which implement IDataStore and then called save using "DynamicDataStoreFactory.Instance.CreateStore(typeof(AssetStore));" but gothe null reference error. Reason being, DynamicDataStoreFactory.Instance is null. Configuration has connection string, provider described in  . What else will we have to do so that the  DynamicDataStoreFactory.Instance can be created.

Kindly help.

Thanks

Neha

#178804
May 23, 2017 6:12
Vote:
 

Hi Neha,

Is there a reason why Web API has to be separate from the Episerver site? Have you thought about raising the Web API endpoints within the Episerver CMS Project and adding your DDS code from there? That way you get all of the Episerver configuration for free.

#178868
May 24, 2017 18:55
Vote:
 

Hey thanks for responding!

We are using WebAPI so that the services can be exposed publically and be used by many other applications. Due to this reason, we are maintaining the solution seperate so that deployment and maintainance can be handled independent of the epi site.

Help me know considering this, do we have the solution for implementing DDS here? 

#178903
May 26, 2017 5:47
Vote:
 

Hi Neha,

Thanks for the explanation. Ultimately, the DynamicDataStoreFactory Instance is initialized through Episerver's InitializationModule. So, if you want to use DDS outside of the CMS framework, you will need to somehow "mimick" the initialization steps automated by Episerver in addition to adding in the necessary configuration in the web/app.config. Here's a blog and forum post that might be of help. However, as you can see, this task can be daunting and could be a maintenance nightmare when upgrading.

One possible workaround is exposing Web API endpoints inside of Episerver that contain all DDS CRUD operations, and then exposing another set of Web API endpoints outside of Epi to contain all necessary business logic (or, of course, contain both CRUD operations/business logic in the endpoints inside of Episerver). Hope this helps!

-RJ

#178939
May 26, 2017 19:37
* 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.