Пример #1
0
        internal Entity( string name, params IEntityExtension[] extensions )
        {
            this.properties = new EntityPropertyStorage(this);
            this.Name = name;

            foreach ( IEntityExtension extension in extensions )
            {
                this.AddExtension( extension );
            }
        }
Пример #2
0
        protected virtual void DisposeManaged()
        {
            lock ( this.actionHandlersLockObject )
            {
                if ( this.actionHandlers != null )
                {
                    this.actionHandlers.Clear();
                    this.actionHandlers = null;
                }
            }

            lock ( this.extensionsLock )
            {
                if ( this.extensions != null )
                {
                    foreach ( KeyValuePair<string,IEntityExtension> kvp in this.extensions )
                    {
                        kvp.Value.Detatch( this, this );

                        // TODO: is this necessary?
                        kvp.Value.Dispose();
                    }

                    this.extensions.Clear();
                    this.extensions = null;
                }
            }

            lock ( this.propertiesLock )
            {
                if ( this.properties != null )
                {
                    this.properties.Dispose();
                    this.properties = null;
                }
            }

            lock ( this.updateRequestedLock )
            {
                if ( this.updateRequested != null )
                {
                    this.updateRequested = null;
                }
            }

            lock ( this.extensionAddedLock )
            {
                if ( this.extensionAdded != null )
                {
                    this.extensionAdded = null;
                }
            }

            lock ( this.extensionRemovedLock )
            {
                if ( this.extensionRemoved != null )
                {
                    this.extensionRemoved = null;
                }
            }
        }