Interface IEntityService
Represents the entity API service.
Namespace: Relativity.Testing.Framework.Api.Services
Assembly: Relativity.Testing.Framework.Api.dll
Syntax
public interface IEntityService
Examples
_entityService = relativityFacade.Resolve<IEntityService>();
Methods
| Improve this Doc View SourceCreate(Int32, Entity)
Creates the specified production.
Declaration
Entity Create(int workspaceId, Entity entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to create entity. |
Entity | entity | The entity to create. |
Returns
Type | Description |
---|---|
Entity | The created entity. |
Examples
var workspaceId = 1015427;
var entity = new Entity
{
FullName = Randomizer.GetString(),
Type = new NamedArtifact { Name = "Other" },
DocumentNumberingPrefix = Randomizer.GetString(),
Classification = new List<NamedArtifact> { new NamedArtifact { Name = "Custodian – Processing" } }
};
var createdEntity = _entityService.Create(workspaceId, entity);
|
Improve this Doc
View Source
Delete(Int32, Int32)
Deletes the entity by the specified artifact ID.
Declaration
void Delete(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to delete the entity. |
System.Int32 | entityId | The Artifact ID of entity. |
Examples
var workspaceId = 1015427;
var someEntityId = 1;
_entityService.Delete(workspaceId, someEntityId);
|
Improve this Doc
View Source
Exists(Int32, Int32)
Determines whether the entity with the specified case artifact ID exists.
Declaration
bool Exists(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace. |
System.Int32 | entityId | The Artifact ID of the entity. |
Returns
Type | Description |
---|---|
System.Boolean | true if a entity exists; otherwise, false. |
Examples
var workspaceId = 1015427;
var someEntityId = 1;
var entityExists = _entityService.Exists(workspaceId, someEntityId);
|
Improve this Doc
View Source
Get(Int32, Int32)
Gets the entity by the specified ID.
Declaration
Entity Get(int workspaceId, int entityId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to get the entity. |
System.Int32 | entityId | The Artifact ID of the entity. |
Returns
Type | Description |
---|---|
Entity |
|
Examples
var workspaceId = 1015427;
var someEntityId = 1;
var entity = _entityService.Get(workspaceId, someEntityId);
|
Improve this Doc
View Source
GetAll(Int32)
Gets all entities.
Declaration
Entity[] GetAll(int workspaceId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to get the all entities. |
Returns
Type | Description |
---|---|
Entity[] | The collection of Entity entities. |
Examples
var workspaceId = 1015427;
var entities = _entityService.GetAll(workspaceId);
|
Improve this Doc
View Source
Require(Int32, Entity)
Requires the specified entity.
- If [ArtifactID](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Artifact.html#Relativity_Testing_Framework_Models_Artifact_ArtifactID) property of
entity
has positive value, gets entity by ID and updates it. - If [FullName](https://relativitydev.github.io/relativity.testing.framework/api/Relativity.Testing.Framework.Models.Entity.html#Relativity_Testing_Framework_Models_Entity_FullName) full name property of
entity
have a value, gets entity by full name and updates it if it exists. - Otherwise creates a new entity using Relativity.Testing.Framework.Api.Strategies.ICreateWorkspaceEntityStrategy`1.
Declaration
Entity Require(int workspaceId, Entity entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to require entity. |
Entity | entity | The entity to require. |
Returns
Type | Description |
---|---|
Entity | The Entity entity or null. |
Examples
var workspaceId = 1015427;
var someEntityId = 1;
var entityToUpdate = _entityService.Get(workspaceId, someEntityId);
entityToUpdate.FirstName = "Some Updated Name";
entityToUpdate.DocumentNumberingPrefix = Randomizer.GetString();
var updatedEntity = _entityService.Require(workspaceId, entityToUpdate); // Will get the entity by ArtifactId, update it and return updated entity
var workspaceId = 1015427;
var entityToUpdate = new Entity
{
FullName = "Some Existing Entity Full Name",
DocumentNumberingPrefix = Randomizer.GetString(),
Type = new NamedArtifact { Name = "Person", ArtifactID = someExistingTypeArtifactId }
}
var updatedEntity = _entityService.Require(workspaceId, entityToUpdate); // Will get the entity by Full Name, update it and return updated entity
var workspaceId = 1015427;
var entity = new Entity
{
FullName = Randomizer.GetString(),
Type = new NamedArtifact { Name = "Other" },
DocumentNumberingPrefix = Randomizer.GetString(),
Classification = new List<NamedArtifact> { new NamedArtifact { Name = "Custodian – Processing" } }
};
var createdEntity = _entityService.Require(workspaceId, entity); // Will create new entity
|
Improve this Doc
View Source
Update(Int32, Entity)
Updates the specified entity.
Declaration
void Update(int workspaceId, Entity entity)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | workspaceId | The Artifact ID of the workspace where you want to update the entity. |
Entity | entity | The entity to update. |
Examples
var workspaceId = 1015427;
var someExistingEntityArtifactId = 1;
var someExistingTypeArtifactId = 2;
var entityToUpdate = new Entity
{
ArtifactId = someExistingEntityArtifactId,
FirstName = "Updated First Name",
LastName = "Updated Last Name",
DocumentNumberingPrefix = Randomizer.GetString(),
Type = new NamedArtifact { Name = "Person", ArtifactID = someExistingTypeArtifactId }
};
_entityService.Update(workspaceId, entityToUpdate);