Example #1
0
        void IRefactorEntity.SetFunctionalId(FunctionalId functionalId, ApplyAlgorithm algorithm)
        {
            Parent.EnsureSchemaMigration();

            if (Inherits?.FunctionalId != null)
            {
                throw new InvalidOperationException($"The entity '{Name}' already inherited a functional id '{Inherits.FunctionalId.Prefix} ({Inherits.FunctionalId.Label})', you cannot assign another one.");
            }

            this.functionalId = functionalId;
            foreach (Entity subclass in this.GetSubclasses())
            {
                subclass.functionalId = null;
            }

            if (algorithm == ApplyAlgorithm.DoNotApply || !Parser.ShouldExecute)
            {
                return;
            }

            foreach (Entity baseClass in this.GetConcreteClasses())
            {
                Parent.Templates.ApplyFunctionalId(template =>
                {
                    template.Entity       = this;
                    template.FunctionalId = functionalId;
                    template.Full         = (algorithm == ApplyAlgorithm.ReapplyAll);
                }).RunBatched();
            }
        }
Example #2
0
        public Entity New(string name, string label, FunctionalId functionId, Entity?inherits = null)
        {
            Entity value = new Entity(Parent, name, label, functionId, inherits);

            collection.Add(name, value);

            return(value);
        }
Example #3
0
 protected abstract void ApplyFunctionalId(FunctionalId functionalId);
Example #4
0
 public Entity New(string name, FunctionalId functionId, Entity?inherits = null)
 {
     return(New(name, name, functionId, inherits));
 }