示例#1
0
        protected void NotifyModified()
        {
            if (_updateCounter.Value > 0)
            {
                // Inside a BeginUpdate/EndUpdate block
                return;
            }

            if (_modified)
            {
                // The client sent at least one update -> increase version of SO
                UpdateVersion();
                _lastModified = System.Environment.TickCount;

                if (_storage != null)
                {
                    if (!_storage.Save(this))
                    {
                        log.Error(__Res.GetString(__Res.SharedObject_StoreError));
                    }
                }
            }
            SendUpdates();
            _modified = false;
        }
 /// <summary>
 /// Set last modified flag to current system time.
 /// </summary>
 protected void OnModified()
 {
     _lastModified = System.Environment.TickCount;
     if (_store != null)
     {
         _store.Save(this);
     }
 }
示例#3
0
		/// <summary>
		/// Creates shared object with given parent scope, name, persistence flag state and store object.
		/// </summary>
		/// <param name="parent"></param>
		/// <param name="name"></param>
		/// <param name="persistent"></param>
		/// <param name="store"></param>
		public SharedObjectScope(IScope parent, string name, bool persistent, IPersistenceStore store)
			: base(parent, SharedObjectService.ScopeType, name, persistent) {
			string path = parent.ContextPath;
			if (!path.StartsWith("/"))
				path = "/" + path;
			// Create shared object wrapper around the attributes
			_so = store.Load(name) as SharedObject;
			if (_so == null) {
				_so = new SharedObject(_attributes, name, path, persistent, store);
				store.Save(_so);
			} else {
				_so.Name = name;
				_so.Path = parent.ContextPath;
				_so.Store = store;
			}
		}
示例#4
0
        /// <summary>
        /// Creates shared object with given parent scope, name, persistence flag state and store object.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="name"></param>
        /// <param name="persistent"></param>
        /// <param name="store"></param>
        public SharedObjectScope(IScope parent, string name, bool persistent, IPersistenceStore store) : base(parent, SharedObjectService.ScopeType, name, persistent)
        {
            string path = parent.ContextPath;

            if (!path.StartsWith("/"))
            {
                path = "/" + path;
            }
            // Create shared object wrapper around the attributes
            _so = store.Load(name) as SharedObject;
            if (_so == null)
            {
                _so = new SharedObject(_attributes, name, path, persistent, store);
                store.Save(_so);
            }
            else
            {
                _so.Name  = name;
                _so.Path  = parent.ContextPath;
                _so.Store = store;
            }
        }
示例#5
0
        public SharedObjectScope(IScope parent, string name, bool persistent, IPersistenceStore store) : base(parent, SharedObjectService.ScopeType, name, persistent)
        {
            this._serverListeners  = new CopyOnWriteArray();
            this._handlers         = new Hashtable();
            this._securityHandlers = new CopyOnWriteArray();
            string contextPath = parent.ContextPath;

            if (!contextPath.StartsWith("/"))
            {
                contextPath = "/" + contextPath;
            }
            this._so = store.Load(name) as SharedObject;
            if (this._so == null)
            {
                this._so = new SharedObject(base._attributes, name, contextPath, persistent, store);
                store.Save(this._so);
            }
            else
            {
                this._so.Name  = name;
                this._so.Path  = parent.ContextPath;
                this._so.Store = store;
            }
        }