Exemplo n.º 1
0
 public void LoadCollision(CollisionManager collision)
 {
     this.Collision = collision;
     foreach (var item in objectInstances.SelectMany(x => x.Value))
     {
         Collision.World.AddCollisionObject(item.CollisionObject);
     }
 }
Exemplo n.º 2
0
 bool RemoveAll(RegisterType registerType, object obj)
 {
     return(_refs
            .SelectMany(e => e.Value
                        .Where(entry => entry.Object == obj)
                        .Select(entry => new ValueTuple <object, RegisterEntry>(e.Key, entry))
                        )
            .ToList()
            .Aggregate(false, (current, tuple) => current || _refs.Remove(tuple.Item1, tuple.Item2)));
 }
Exemplo n.º 3
0
 private void DiscoverEntityTypes()
 {
     schemaSpaceEntityTypes = entityTypeDiscovery.DiscoverEntities();
     entityTypeSchemaSpaces = schemaSpaceEntityTypes
                              .SelectMany(x => x.Value, (key, entityType) => new { SchemaSpace = key.Key, EntityType = entityType })
                              .ToDictionary(x => x.EntityType, x => x.SchemaSpace);
     SchemaSpaces = schemaSpaceEntityTypes.Keys.ToList();
 }
Exemplo n.º 4
0
        public virtual void SaveChanges()
        {
            List <EntityEntry> added    = new List <EntityEntry>();
            List <EntityEntry> modified = new List <EntityEntry>();
            List <EntityEntry> removed  = new List <EntityEntry>();
            MultiValueDictionary <EntityEntry, DomainAggregateEvent> publishedEvents = new MultiValueDictionary <EntityEntry, DomainAggregateEvent>();

            foreach (EntityEntry entry in Aggregates.ToList())
            {
                if (entry.EntityState == EntityState.Added || entry.EntityState == EntityState.Modified ||
                    entry.Instance.IsChanged || entry.Instance.IsDeleted)
                {
                    if (entry.EntityState == EntityState.Added)
                    {
                        added.Add(entry);
                    }
                    else if (entry.EntityState == EntityState.Modified || entry.Instance.IsChanged)
                    {
                        modified.Add(entry);
                    }

                    entry.EntityState = EntityState.Unchanged;

                    foreach (DomainAggregateEvent domainEvent in entry.Instance.UncommittedEvents)
                    {
                        publishedEvents.Add(entry, domainEvent);
                    }

                    if (entry.Instance.IsDeleted)
                    {
                        entry.EntityState = EntityState.Removed;
                    }
                    else
                    {
                        entry.Instance.Commit();
                    }
                }

                if (entry.EntityState == EntityState.Removed)
                {
                    removed.Add(entry);
                    Aggregates.Remove(entry);
                }
            }

            saveTransactions.Add(
                new SaveTransaction(added, modified, removed,
                                    publishedEvents
                                    .SelectMany(x => x.Value.Select(y => new KeyValuePair <EntityEntry, DomainAggregateEvent>(x.Key, y)))
                                    .ToLookup(x => x.Key, x => x.Value)));
        }
Exemplo n.º 5
0
 public IEnumerator <IBinding> GetEnumerator()
 {
     return(dictionary.SelectMany(kv => kv.Value).GetEnumerator());
 }