public void ChangeTo(DomainObject obj) { m_object[obj.ObjectId] = obj; }
public void Add(DomainObject obj) { m_object.Add(obj.ObjectId, obj); }
private void PutToStorage(DomainObject obj) { DomainObject sharedObj = CloneObject(obj, SessionIdentifier.SHARED_SESSION); m_sharedObjRepository.Add(sharedObj); }
private DomainObject CloneObject(DomainObject obj, SessionIdentifier newSession) { DomainPropertyCollection propertyCollection = new DomainPropertyCollection(); //EntityLinkCollection linkCollection = new EntityLinkCollection(); foreach (DomainProperty property in obj.Properties) { DomainProperty newProperty = CloneProperty(property, newSession); propertyCollection.Add(newProperty); } //foreach (EntityLink link in obj.Links) //{ // EntityLink newLink = CloneLink(link, newSession); // linkCollection.Add(newLink); //} DomainObject result = m_objectFactory.CreateDomainObject(newSession, obj.ObjectId); result.Init(propertyCollection); return result; }
public void EngGetObject(DomainObject obj) { object lockObject = null; lock (m_getObjectLock) { m_getObjectLock.TryGetValue(obj.ObjectId, out lockObject); } // если в списке есть элемент с этим Id, то это первый поток и надо сохранить его в глобальное хранилище if (lockObject != null) { lock (m_sharedObjRepositoryLock) { PutToStorage(obj); } lock (m_getObjectLock) { m_getObjectLock.Remove(obj.ObjectId); } Monitor.Exit(lockObject); } }
internal void AddObject(DomainObject obj) { m_objRepository.Add(obj); }