public void MarkAsRequested(DependentObject dependentObject, string agentId, string zoneId)
        {
            if (dependentObject == null)
            {
                throw new ArgumentNullException("cachedObject");
            }

            if (String.IsNullOrEmpty(agentId) || String.IsNullOrEmpty(zoneId))
            {
                throw new ArgumentException("agentId and/or zoneId parameter is null or empty.");
            }

            dependentObject.AgentId = agentId;
            dependentObject.ZoneId = zoneId;
            dependentObject.RequestedDate = DateTime.Now;
            dependentObject.Requested = true;
            dependentObjectDao.Save(dependentObject);
        }
        private void CreateInitialData()
        {
            DependentObject dependentObject1 = new DependentObject { SifObjectName = "StudentPersonal", ObjectKeyValue = "st1" };
            DependentObject dependentObject2 = new DependentObject { SifObjectName = "StudentPersonal", ObjectKeyValue = "st2" };

            cachedObjects = new[]
            {
                new CachedObject
                {
                    SifObjectName = "TeachingGroup", ObjectKeyValue = "tg1", ApplicationId = "app1", ZoneId = "zone1", DependentObjects = new Collection<DependentObject>
                    {
                        dependentObject1,
                        dependentObject2
                    }
                },
                new CachedObject
                {
                    SifObjectName = "StudentSchoolEnrolment", ObjectKeyValue = "se1", DependentObjects = new Collection<DependentObject>
                    {
                        dependentObject1
                    }
                },
                new CachedObject
                {
                    SifObjectName = "StudentPersonal", ObjectKeyValue = "sp1", AgentId = "agent", ApplicationId = "app", ExpiryDate = DateTime.Now.Subtract(TimeSpan.FromDays(1)), DependentObjects = new Collection<DependentObject>
                    {
                        new DependentObject { SifObjectName = "DummyObject1", ObjectKeyValue = "do1" }
                    }
                },
                new CachedObject
                {
                    SifObjectName = "StudentPersonal", ObjectKeyValue = "sp2", AgentId = "agent", ApplicationId = "app", ExpiryDate = DateTime.Now.AddDays(1), DependentObjects = new Collection<DependentObject>
                    {
                        new DependentObject { SifObjectName = "DummyObject2", ObjectKeyValue = "do2" }
                    }
                },
                new CachedObject { SifObjectName = "StudentPersonal", ObjectKeyValue = "sp3", AgentId = "agent", ApplicationId = "app" }
            };

            using (ISession session = sessionFactory.OpenSession())
            {

                using (ITransaction transaction = session.BeginTransaction())
                {

                    foreach (CachedObject cachedObject in cachedObjects)
                    {
                        session.Save(cachedObject);
                    }

                    transaction.Commit();
                }

            }
        }
        public void Save()
        {
            DependentObject savedObject = new DependentObject { SifObjectName = "StudentAttendance", ObjectKeyValue = "key3" };
            (new DependentObjectDao()).Save(savedObject);
            if (log.IsDebugEnabled) log.Debug("Saved object: " + savedObject);
            Console.WriteLine("Saved object: " + savedObject);

            using (ISession session = sessionFactory.OpenSession())
            {
                DependentObject comparisonObject = session.Get<DependentObject>(savedObject.Id);
                if (log.IsDebugEnabled) log.Debug("Comparison object: " + comparisonObject);
                Console.WriteLine("Comparison object: " + comparisonObject);
                Assert.IsNotNull(comparisonObject);
                Assert.AreNotSame(savedObject, comparisonObject);
                Assert.AreEqual(savedObject.SifObjectName, comparisonObject.SifObjectName);
                Assert.AreEqual(savedObject.ObjectKeyValue, comparisonObject.ObjectKeyValue);
            }
        }
 /// <see cref="Systemic.Sif.Sbp.Framework.Service.IDependentObjectCacheService.DeleteDependentObject(DependentObject)">DeleteDependentObject</see>
 public void DeleteDependentObject(DependentObject dependentObject)
 {
     dependentObjectDao.Delete(dependentObject);
 }
        public void RetrieveFail()
        {
            using (ISession session = sessionFactory.OpenSession())
            {
                DependentObject addedObject = new DependentObject { SifObjectName = "StudentPersonal", ObjectKeyValue = "st1", ApplicationId = "app1", ZoneId = "zone1" };
                session.Save(addedObject);
            }

            DependentObject retrievedObject = (new DependentObjectDao()).Retrieve("StudentPersonal", "st1", "app1", "zone1");
        }