Exemplo n.º 1
0
        internal void HandleEntityChange(ChangeType changeType, IPersistEntity entity, int property)
        {
            switch (changeType)
            {
            case ChangeType.New:
                if (EntityNew != null)
                {
                    EntityNew(entity);
                }
                break;

            case ChangeType.Deleted:
                if (EntityDeleted != null)
                {
                    EntityDeleted(entity);
                }
                break;

            case ChangeType.Modified:
                if (EntityModified != null)
                {
                    EntityModified(entity, property);
                }
                if (entity != null)
                {
                    //Ass entity to 'Modified' collection. This is the single point of access where all changes go through
                    //so it is the best place to keep the track reliably.
                    Cache.AddModified(entity);
                }

                break;

            default:
                throw new ArgumentOutOfRangeException("changeType", changeType, null);
            }
        }