Esempio n. 1
0
        /// <inheritdoc />
        public override CdmObject Copy(ResolveOptions resOpt = null, CdmObject host = null)
        {
            if (resOpt == null)
            {
                resOpt = new ResolveOptions(this, this.Ctx.Corpus.DefaultResolutionDirectives);
            }

            CdmConstantEntityDefinition copy;

            if (host == null)
            {
                copy = new CdmConstantEntityDefinition(this.Ctx, this.ConstantEntityName);
            }
            else
            {
                copy     = host as CdmConstantEntityDefinition;
                copy.Ctx = this.Ctx;
                copy.ConstantEntityName = this.ConstantEntityName;
            }

            copy.EntityShape = (CdmEntityReference)this.EntityShape.Copy(resOpt);
            if (this.ConstantValues != null)
            {
                // deep copy the content
                copy.ConstantValues = new List <List <string> >();
                foreach (var row in this.ConstantValues)
                {
                    copy.ConstantValues.Add(new List <string>(row));
                }
            }
            this.CopyDef(resOpt, copy);
            return(copy);
        }
Esempio n. 2
0
        /// <inheritdoc />
        public override CdmObject Copy(ResolveOptions resOpt = null, CdmObject host = null)
        {
            if (resOpt == null)
            {
                resOpt = new ResolveOptions(this, this.Ctx.Corpus.DefaultResolutionDirectives);
            }

            CdmConstantEntityDefinition copy;

            if (host == null)
            {
                copy = new CdmConstantEntityDefinition(this.Ctx, this.ConstantEntityName);
            }
            else
            {
                copy     = host as CdmConstantEntityDefinition;
                copy.Ctx = this.Ctx;
                copy.ConstantEntityName = this.ConstantEntityName;
            }

            copy.EntityShape    = (CdmEntityReference)this.EntityShape.Copy(resOpt);
            copy.ConstantValues = this.ConstantValues; // is a deep copy needed?
            this.CopyDef(resOpt, copy);
            return(copy);
        }
        public override CdmObject Copy(ResolveOptions resOpt = null)
        {
            if (resOpt == null)
            {
                resOpt = new ResolveOptions(this);
            }

            CdmConstantEntityDefinition copy = new CdmConstantEntityDefinition(this.Ctx);

            copy.ConstantEntityName = this.ConstantEntityName;
            copy.EntityShape        = (CdmEntityReference)this.EntityShape.Copy(resOpt);
            copy.ConstantValues     = this.ConstantValues; // is a deep copy needed?
            this.CopyDef(resOpt, copy);
            return(copy);
        }