Exemplo n.º 1
0
        static void BuildEntityView(EGID entityID, Dictionary <Type, ITypeSafeDictionary> @group,
                                    Type entityViewType, IEntityBuilder entityBuilder, object[] implementors)
        {
            ITypeSafeDictionary safeDictionary;

            var entityViewsPoolWillBeCreated =
                @group.TryGetValue(entityViewType, out safeDictionary) == false;

            //passing the undefined entityViewsByType inside the entityViewBuilder will allow
            //it to be created with the correct type and casted back to the undefined list.
            //that's how the list will be eventually of the target type.
            entityBuilder.BuildEntityViewAndAddToList(ref safeDictionary, entityID, implementors);

            if (entityViewsPoolWillBeCreated)
            {
                @group.Add(entityViewType, safeDictionary);
            }
        }