Ejemplo n.º 1
0
 private void FireExtensionRemovedEvent( IEntityExtension extension )
 {
     lock ( this.extensionRemovedLock )
     {
         if ( this.extensionRemoved != null )
         {
             this.extensionRemoved( this, extension );
         }
     }
 }
Ejemplo n.º 2
0
        public bool Equals( IEntityExtension other )
        {
            if ( other == null ) return false;

            bool nameEqual = ( this.Name == null ) ? other.Name == null : this.Name == other.Name;
            bool typeEqual = this.GetType() == other.GetType();

            return typeEqual && nameEqual;
        }
Ejemplo n.º 3
0
        public void AddExtension( IEntityExtension extension )
        {
            if ( extension == null )
            {
                throw new ArgumentNullException( "extension", "The given extension must not be null." );
            }

            try
            {
                lock ( this.extensionsLock )
                {
                    this.extensions.Add( extension.Name, extension );
                }

                //( ( EntityExtension ) extension ).PublicizeEntityProperties( this.Properties as IEntityExtensionPublicationStorage );
                //this.Properties.SwapAndFlush();
                //this.UpdateRequested += ( ( EntityExtension ) extension ).PublicizeEntityProperties;
            }
            catch ( ArgumentNullException )
            {
                // LOG?
                throw;
            }
            catch ( ArgumentException argEx )
            {
                throw new DuplicateExtensionException( "This entity already has an extension with the name '" + extension.Name + "'", argEx );
            }

            extension.Attatch( this, this.Properties as IEntityExtensionPublicationStorage, this as IActionRequestable, this );
            this.Properties.SwapAndFlush();

            this.FireExtensionAddedEvent( extension );
        }