/// <inheritdoc /> public override CdmObjectReference CreateSimpleReference(ResolveOptions resOpt = null) { if (resOpt == null) { resOpt = new ResolveOptions(this, this.Ctx.Corpus.DefaultResolutionDirectives); } string name; if (!string.IsNullOrEmpty(this.DeclaredPath)) { name = this.DeclaredPath; } else { name = this.GetName(); } CdmObjectReferenceBase cdmObjectRef = this.Ctx.Corpus.MakeObject <CdmObjectReferenceBase>(CdmCorpusDefinition.MapReferenceType(this.ObjectType), name, true) as CdmObjectReferenceBase; if (resOpt.SaveResolutionsOnCopy) { // used to localize references between documents cdmObjectRef.ExplicitReference = this; cdmObjectRef.InDocument = this.InDocument; } return(cdmObjectRef); }
/// Creates a 'portable' reference object to this object. portable means there is no symbolic name set until this reference is placed /// into some final document. internal override CdmObjectReference CreatePortableReference(ResolveOptions resOpt) { CdmObjectReferenceBase cdmObjectRef = this.Ctx.Corpus.MakeObject <CdmObjectReferenceBase>(CdmCorpusDefinition.MapReferenceType(this.ObjectType), "portable", true) as CdmObjectReferenceBase; cdmObjectRef.ExplicitReference = this.Copy() as CdmObjectDefinition; cdmObjectRef.InDocument = this.InDocument; // where it started life cdmObjectRef.Owner = this.Owner; return(cdmObjectRef); }
/// Creates a 'portable' reference object to this object. portable means there is no symbolic name set until this reference is placed /// into some final document. internal override CdmObjectReference CreatePortableReference(ResolveOptions resOpt) { CdmObjectReferenceBase cdmObjectRef = this.Ctx.Corpus.MakeObject <CdmObjectReferenceBase>(CdmCorpusDefinition.MapReferenceType(this.ObjectType), "portable", true) as CdmObjectReferenceBase; cdmObjectRef.ExplicitReference = this.FetchObjectDefinition <CdmObjectDefinition>(resOpt); if (cdmObjectRef.ExplicitReference == null || (cdmObjectRef.InDocument == null && this.InDocument == null)) { return(null); // not allowed } if (cdmObjectRef.InDocument == null) { cdmObjectRef.InDocument = this.InDocument; // if the object has no document, take from the reference } return(cdmObjectRef); }