Exemple #1
0
 internal void InitializeFromData( EntityData data )
 {
     this.InitializeAspects();
     this.data = data;
     this.id = data.Id;
     this.entityStatus = EntityStatus.Clean;
 }
Exemple #2
0
        public void UpdateEntity( EntityData entityData )
        {
            EntityData existingData;
            if ( entities.TryGetValue( entityData.Id, out existingData ) )
            {
                if ( entityData.Revision > existingData.Revision )
                {
                    entities[entityData.Id] = entityData;

                    if ( EntityUpdated != null )
                    {
                        EntityUpdated( null, new EntityEventArgs( entityData ) );
                    }
                }
            }
            else
            {
                entities.Add( entityData.Id, entityData );

                if ( EntityCreated != null )
                {
                    EntityCreated( null, new EntityEventArgs( entityData ) );
                }
            }
        }
Exemple #3
0
        protected Entity( EntityData data )
        {
            if ( data.EntityType == EntityType.Unknown )
                throw new ArgumentOutOfRangeException();

            this.id = Guid.NewGuid();
            this.data = data;
            this.data.Id = this.id;
            this.entityStatus = EntityStatus.New;
        }
Exemple #4
0
        internal void OnUpdated( EntityData data )
        {
            switch ( this.EntityStatus )
            {
                case EntityStatus.Dirty:
                    this.entityStatus = EntityStatus.Conflict;
                    this.OnPropertyChanged("EntityStatus");
                    return;
            }

            this.data = data;
            this.OnPropertyChanged( null );
        }
Exemple #5
0
 public EntityEventArgs( EntityData entityData )
 {
     this.Entity = entityData;
 }