/// <summary>
        ///     Merges an <see cref="Acl" /> into the entity's existing set of ACLs.
        /// </summary>
        public static void MergeAcl(this Worker.Entity entity, Acl newAcl)
        {
            if (entity.Get <EntityAcl>().HasValue)
            {
                entity.Update(Acl.MergeIntoAcl(entity.Get <EntityAcl>().Value.Get().Value, newAcl).ToUpdate());
                return;
            }

            entity.Add(newAcl.ToData());
        }
        /// <summary>
        ///     Adds an ACL component to an entity or overwrites an existing one.
        /// </summary>
        public static void SetAcl(this Worker.Entity entity, Acl acl)
        {
            if (entity.Get <EntityAcl>().HasValue)
            {
                entity.Update(acl.ToUpdate());
                return;
            }

            entity.Add(acl.ToData());
        }
예제 #3
0
        /// <inheritdoc cref="IComponentAdder.Build" />
        public Worker.Entity Build()
        {
            if (hasBuiltOnce)
            {
                throw new System.InvalidOperationException("Cannot call Build() multiple times on an EntityBuilder");
            }

            hasBuiltOnce = true;
            entity.Add(entityAcl.ToData());
            return(entity);
        }