Vulnerability in EPiServer.Forms
I would like to know if it is possible to use DDS from another non EPiServer website.
I would like to move some web services from an existing episerver website into another website which has its own application pool.
As far as im aware, there are a couple of ways of doing this.
1. Use the DDS API's from the EPiServer dll's in the separate services website.
2. Insert data into DDS by calling directly the stored procedures created in the database for each user data store (i.e Save_MyDataStore).
I think there could be a couple of issues with these two methods:
1. Using the DDS API's - I don't know whether I will need an EPiServer licence in the website to run this.
2. Using the stored procedures - is this safe? The only concern I have is with the caching EPiServer does. I guess caching will be ok as long as the DDS cache on the website uses an SQL dependency.
Has anyone implemented something like this before or can comment on the above?
Last time I checked there where no check for license in EPiServer.Data.dll (or dependent assemblies) so it should work to run them in a separate instance but you will never get any guaranties the they will not add license checks in the future.
If you update the database directly you will run into problem because DDS does not use a SQL Dependencies.
You will probably need to add EPiServer.Data, EPiServer.Framework, EPiServer.Data.Cache and EPiServer.Events to you service, sprinkle with some configuration (connectionStrings, WCF for EPiServer Events, etc).
At least for the first version of the DDS, Paul Smith published s Unit Test project that run separatly. It can be downloaded here.
Please let us know the results of your tests!
Thanks Fredrik - I'll have a look and let you know how we get on.
Hi, I wrote on similar topic some time ago - http://world.episerver.com/Blogs/Valdis-Iljuconoks/Dates/2011/10/If-all-you-need-is-just-Dynamic-Data-Store/
Thanks Valdis - I am working with Joel on this (who has commented on your blog post).
I think we are running into structure map issues as we are using EPiServer 7 (so the episerver 7 dlls for data etc).
Have you been able to get this working against an EPiServer 7 instance of DDS?
Great. This was used in CMS6. I'll check what's the case in v7. StructureMap needs to be initialized beforehand using any base classes as most of the interfaces are retrieved via ServiceLocator.
Try this code:
var container = new Container();
var factory = new SqlDatabaseFactory();
container.Configure(ce => ce.For<IDatabaseHandler>().Use(factory.CreateDefaultHandler));
// if you need caching - replace `null'
DataInitialization.InitializeFromCode(container, factory, null);
var store = typeof(SampleModel).GetStore();
NB! <episerver.dataStore> element for v7 is optional. If you still add it - be sure to clear providers list before adding - otherwise you will get "Key has already been added" type of exception.
Well that certainly seems to be doing the trick! Now we are successfully writing to DDS outside of an EPiServer website.
I wondered why I was getting those key already added errors and didn't realise that the <episerver.datastore> section was optional in v7.
Thanks very much for your help. It all looks so simple when you know what you are doing!
Can you get data from the DDS using an internal webservice?
I seem to be getting zero items back but using the same code on a normal page I get results.