Editar

Partilhar via


Corpus

The corpus is a top-level folder that provides the most important basic functionalities to deal with the object model. There will usually only be one corpus when dealing with the object model.

public class CdmCorpusDefinition

Constructors

Name Description
CdmCorpusDefinition() Initializes a new instance of the CdmCorpusDefinition class.

Properties

Name Type Description
Ctx ResolveContext Holds information about current executing resolution context, including configuration for the logging subsystem.
RootPath string The root path of the corpus.
Storage StorageManager The storage for the corpus. Used for interacting with storage adapters.
AppId string The ID of the application using the object model. This is an optional property.
DefaultResolutionDirectives AttributeResolutionDirectiveSet The set of default resolution directives that will be used by the object model when it's resolving entities and when no per-call set of directives is provided.
TelemetryClient TelemetryClient The client for telemetry collection. This is an optional property.

Methods

Name Description Return Type
MakeRef<T>(CdmObjectType, dynamic, bool)
ofType: The type of the object we want to create.
refObj: The reference object.
simpleNameRef: A boolean that denotes whether it's a simple name reference.
Instantiates a Common Data Model object reference based on the object type passed as the first parameter. T, where T extends CdmObjectReference
MakeObject<T>(CdmObjectType, string, bool)
ofType: The type of the object we want to create.
nameOrRef [optional]: The name or reference.
simpleNameRef [optional]: A boolean that denotes whether the reference is simple named or not. The default value is false.
Instantiates a Common Data Model object based on the object type passed as the first parameter. T, where T extends CdmObject
FetchObjectAsync<T>(string, CdmObject, bool)
objectPath: The object path of a folder or document. The path can be absolute or relative.
obj [optional]: When provided, it's used to obtain the FolderPath and Namespace that are needed to create the absolute path from a relative path.
shallowValidation [optional]: When provided, shallow validation in ResolveOptions is enabled, which logs errors regarding loading and resolving object references as warnings instead.
forceReload [optional]: When true, the document containing the requested object is reloaded from storage to access any external changes made to the document since it may have been cached by the corpus.
Fetches the object in the specified path from the corpus. If the object found at the objectPath does not match the type T, an error will occur. In C# the method will report error code ErrInvalidCast and return null. In Java, Python and Typescript a casting exception will be thrown and should be handled by the caller. Task<T>
SetEventCallback(EventCallback, CdmStatusLevel, string)
status: The callback.
reportAtLevel: At which status level to report.
correlationId: Optional correlation ID to attach to messages.
Sets a callback object that gets invoked when status/warning/error messages are logged, and the status level the callback should be invoked at. void
CalculateEntityGraphAsync(CdmManifestDefinition, ResolveOptions)
currManifest: The manifest (and any sub-manifests it contains) that we want to calculate relationships for.
resOpt: The resolve options.
Calculates the entity-to-entity relationships for all the entities present in the manifest and its sub-manifests. Task
FetchIncomingRelationships(CdmEntityDefinition)
entity: The entity that we want to get relationships for.
Returns a list of relationships where the input entity is the incoming entity. List<CdmE2ERelationship>
FetchOutgoingRelationships(CdmEntityDefinition)
entity: The entity for which we want to get relationships.
Returns a list of relationships where the input entity is the outgoing entity. List<CdmE2ERelationship>