public ActionResult TestRepoContactGetTestModelValue(string contactid) { Sitecore.Analytics.Data.ContactRepository repo = new Sitecore.Analytics.Data.ContactRepository(); var c = repo.LoadContactReadOnly(contactid); var echo = c.Extensions.Get <TestModel>(testKey); return(Test(echo.TestValue)); }
// this will not work if the session is actio on the current delivery cluster public ActionResult TestRepoContactAddTestModelValue(string contactid, string echo) { Sitecore.Analytics.Data.ContactRepository repo = new Sitecore.Analytics.Data.ContactRepository(); var c = repo.TryLoadContact( contactid, new Sitecore.Analytics.Model.LeaseOwner( "TestController", Sitecore.Analytics.Model.LeaseOwnerType.WebCluster), TimeSpan.FromSeconds(10)); var model = c.Object.Extensions.Create <TestModel>(testKey); model.TestValue = echo; repo.SaveContact(c.Object, c.LockedBy, true); return(Test(model.TestValue)); }
public ContactRepository() { _contactRepository = new Sitecore.Analytics.Data.ContactRepository(); }