Exemple #1
0
        public CommandEntity Add(string containerName, CommandEntity entity)
        {
            containerName.GuardAgainstNullOrEmpty(nameof(containerName));
            entity.GuardAgainstNull(nameof(entity));

            var container = EnsureContainer(containerName);

            container.Add(entity.Id, entity.ToFileProperties());

            return(CommandEntity.FromCommandEntity(
                       container.Get(entity.Id).FromFileProperties(entity.Metadata),
                       entity));
        }
        public CommandEntity Add(string containerName, CommandEntity entity)
        {
            containerName.GuardAgainstNullOrEmpty(nameof(containerName));
            entity.GuardAgainstNull(nameof(entity));

            if (!this.containers.ContainsKey(containerName))
            {
                this.containers.Add(containerName, new Dictionary <string, IReadOnlyDictionary <string, object> >());
            }

            this.containers[containerName].Add(entity.Id, entity.ToDictionaryProperties());

            return(CommandEntity.FromCommandEntity(this.containers[containerName][entity.Id].FromDictionaryProperties(),
                                                   entity));
        }