1. IEntity

Interface IEntity

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

Represents an entity in M.

Namespace: Stylelabs.M.Sdk.Contracts.Base
Assembly: Stylelabs.M.Sdk.dll
Syntax
public interface IEntity : IResource, IDirtyTracking

Properties

Cultures

Gets a list of all cultures that the entity was loaded with. Never returns null. All ICultureSensitiveProperty properties can only contains values for these cultures.

Declaration
IReadOnlyList<CultureInfo> Cultures { get; }
Property Value
TypeDescription
IReadOnlyList<CultureInfo>

DefinitionName

Gets the name of the IEntityDefinition that defines this entity.

Declaration
string DefinitionName { get; }
Property Value
TypeDescription
System.String

Id

Gets the id of the entity. The id is an automatically assigned, read only, unique and strictly positive number identifying the entity. The id is null if the entity has not been persisted yet.

Declaration
long? Id { get; }
Property Value
TypeDescription
System.Nullable<System.Int64>

Identifier

Gets the identifier of the entity. The identifier can be set on a new entities, until it is persisted. However, it must always be unique. The identifier will be auto generated when it is null when persisting.

Declaration
string Identifier { get; set; }
Property Value
TypeDescription
System.String

InheritsSecurity

Gets or sets a value indicating whether the entity inherits security from its ancestors connected via relations with InheritsSecurity.

Declaration
bool InheritsSecurity { get; set; }
Property Value
TypeDescription
System.Boolean

IsNew

Gets a value indicating whether the entity is new (id is null).

Declaration
bool IsNew { get; }
Property Value
TypeDescription
System.Boolean

IsPathRoot

Gets or sets a value indicating whether this entity is a top level path.

Declaration
bool IsPathRoot { get; set; }
Property Value
TypeDescription
System.Boolean
See Also

IsRootTaxonomyItem

Gets or sets a value indicating whether this entity is a top level facet.

Declaration
bool IsRootTaxonomyItem { get; set; }
Property Value
TypeDescription
System.Boolean
See Also

IsSystemOwned

Gets or sets a value indicating whether the entity is owned by the system and cannot be modified or deleted by the regular users.

Declaration
bool IsSystemOwned { get; set; }
Property Value
TypeDescription
System.Boolean

LockedBy

Gets the id of the user who locked this entity. null if it has not been locked.

Declaration
long? LockedBy { get; }
Property Value
TypeDescription
System.Nullable<System.Int64>

LockedOn

Gets the date on which this entity was locked. null if it has not been locked.

Declaration
DateTime? LockedOn { get; }
Property Value
TypeDescription
System.Nullable<DateTime>

Properties

Gets a list of all properties that are currently loaded on the entity. Never returns null.

Declaration
IReadOnlyList<IProperty> Properties { get; }
Property Value
TypeDescription
IReadOnlyList<IProperty>
Remarks

New properties can still be added by lazy loading them.

Relations

Gets a list of all relations that are currently loaded on the entity. Never returns null.

Declaration
IReadOnlyList<IRelation> Relations { get; }
Property Value
TypeDescription
IReadOnlyList<IRelation>
Remarks

New relations can still be added by lazy loading them.

Renditions

Gets a list of all renditions for this entity. Never returns null.

Declaration
IReadOnlyList<IRendition> Renditions { get; }
Property Value
TypeDescription
IReadOnlyList<IRendition>

Version

Gets the current version of the entity. Version is a monotonically increasing number (from 1 up). Any change(s) of the entity propagated to the persistent storage will cause this number to be incremented.

Declaration
long Version { get; }
Property Value
TypeDescription
System.Int64

Methods

CanDoLazyLoading()

Checks if lazy loading is possible. Lazy loading is only possible on persisted entities.

Declaration
bool CanDoLazyLoading()
Returns
TypeDescription
System.Boolean

true if lazy loading is possible.

GetEntityDefinitionAsync()

Gets the IEntityDefinition of the entity. It is loaded once and will cache the result.

Declaration
Task<IEntityDefinition> GetEntityDefinitionAsync()
Returns
TypeDescription
Task<IEntityDefinition>

The entity definition.

GetPermissionsAsync()

Gets the permissions that the current user has on this entity.

Declaration
Task<ISet<string>> GetPermissionsAsync()
Returns
TypeDescription
Task<ISet<System.String>>

A case insensitive set of permissions.

GetProperty(String)

Gets the specified property. Returns null when the property is not found.

Declaration
IProperty GetProperty(string name)
Parameters
TypeNameDescription
System.Stringname

Property name.

Returns
TypeDescription
IProperty

The property

GetProperty<T>(String)

Gets the specified property. Returns null when the property is not found.

Declaration
T GetProperty<T>(string name)
    where T : class, IProperty
Parameters
TypeNameDescription
System.Stringname

Property name.

Returns
TypeDescription
T

The property

Type Parameters
NameDescription
T

GetPropertyAsync(String, MemberLoadOption)

Gets the specified property. Returns null when the property is not found. However, if the property is not present, it can be lazy loaded.

Declaration
Task<IProperty> GetPropertyAsync(string name, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
Parameters
TypeNameDescription
System.Stringname

Property name.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<IProperty>

The property

GetPropertyAsync<T>(String, MemberLoadOption)

Gets the specified property. Returns null when the property is not found. However, if the property is not present, it can be lazy loaded.

Declaration
Task<T> GetPropertyAsync<T>(string name, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
    where T : class, IProperty
Parameters
TypeNameDescription
System.Stringname

Property name.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<T>

The property

Type Parameters
NameDescription
T

Type of the property.

GetPropertyValue(String)

Gets the value of the specified culture insensitive property. Returns null when the property is not found.

Declaration
object GetPropertyValue(string name)
Parameters
TypeNameDescription
System.Stringname

Property name.

Returns
TypeDescription
System.Object

The property

GetPropertyValue(String, CultureInfo)

Gets the value of the specified culture sensitive property. Returns null when the property is not found.

Declaration
object GetPropertyValue(string name, CultureInfo culture)
Parameters
TypeNameDescription
System.Stringname

Property name.

CultureInfoculture
Returns
TypeDescription
System.Object

The property

GetPropertyValue<T>(String)

Gets the value of the specified culture insensitive property and casts it to the corresponding type. Returns null when the property is not found.

Declaration
T GetPropertyValue<T>(string name)
Parameters
TypeNameDescription
System.Stringname

Property name.

Returns
TypeDescription
T

The property

Type Parameters
NameDescription
T

GetPropertyValue<T>(String, CultureInfo)

Gets the value of the specified culture sensitive property and casts it to the corresponding type. Returns null when the property is not found.

Declaration
T GetPropertyValue<T>(string name, CultureInfo culture)
Parameters
TypeNameDescription
System.Stringname

Property name.

CultureInfoculture
Returns
TypeDescription
T

The property

Type Parameters
NameDescription
T

GetPropertyValueAsync(String, MemberLoadOption)

Gets the value of the specified culture insensitive property and casts it to the corresponding type. If the property is not present, it can be lazy loaded.

Declaration
Task<object> GetPropertyValueAsync(string name, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
Parameters
TypeNameDescription
System.Stringname

Property name.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<System.Object>

Value of the property. If the property does not exist or is not loaded, it returns null.

GetPropertyValueAsync<T>(String, CultureInfo, MemberLoadOption)

Gets the value of the specified culture sensitive property and converts it to the corresponding type. If the property is not present, it can be lazy loaded.

Declaration
Task<T> GetPropertyValueAsync<T>(string name, CultureInfo culture, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
Parameters
TypeNameDescription
System.Stringname

Property name.

CultureInfoculture

Culture of the value.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<T>

Value of the property in specified culture. If the property does not exist or is not loaded, it returns null.

Type Parameters
NameDescription
T

Type of the value.

GetPropertyValueAsync<T>(String, MemberLoadOption)

Gets the value of the specified culture insensitive property and casts it to the corresponding type. If the property is not present, it can be lazy loaded.

Declaration
Task<T> GetPropertyValueAsync<T>(string name, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
Parameters
TypeNameDescription
System.Stringname

Property name.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<T>

Value of the property. If the property does not exist or is not loaded, it returns null.

Type Parameters
NameDescription
T

Type of the value.

GetRelation(String, Nullable<RelationRole>)

Gets a relation by name. Returns null when the relation was not found.

Declaration
IRelation GetRelation(string name, RelationRole? role = null)
Parameters
TypeNameDescription
System.Stringname

Name of the relation.

System.Nullable<RelationRole>role
Returns
TypeDescription
IRelation

The relation

GetRelation<T>(String)

Gets a relation by name and tries to resolve the role automatically by the specified interface. Returns null when the relation was not found.

Declaration
T GetRelation<T>(string name)
    where T : class, IRelation
Parameters
TypeNameDescription
System.Stringname

Name of the relation.

Returns
TypeDescription
T

The relation

Type Parameters
NameDescription
T

GetRelationAsync(String, Nullable<RelationRole>, MemberLoadOption)

Gets the relation from the entity. Returns null when the relation was not found. However, when the relation is not present, it can be lazy loaded.

Declaration
Task<IRelation> GetRelationAsync(string name, RelationRole? role = null, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
Parameters
TypeNameDescription
System.Stringname

Relation name.

System.Nullable<RelationRole>role

The role of the relation.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<IRelation>

The relation or null when it does not exist or is not lazy loaded.

GetRelationAsync<T>(String, MemberLoadOption)

Gets a relation by name and tries to resolve the role automatically by the specified interface. Returns null when the relation was not found. If the relation is not present, it can be lazy loaded.

Declaration
Task<T> GetRelationAsync<T>(string name, MemberLoadOption loadOption = MemberLoadOption.LazyLoading)
    where T : class, IRelation
Parameters
TypeNameDescription
System.Stringname

Relation name.

MemberLoadOptionloadOption

Enables (default) or disables lazy loading.

Returns
TypeDescription
Task<T>

The relation or null when it does not exist or is not lazy loaded.

Type Parameters
NameDescription
T

Type of relation.

GetRendition(String)

Gets an IRendition by name.

Declaration
IRendition GetRendition(string name)
Parameters
TypeNameDescription
System.Stringname

Name of the rendition

Returns
TypeDescription
IRendition

The rendition or null when it does not exist.

LoadMembersAsync(IPropertyLoadOption, IRelationLoadOption)

Loads the specified members on the current entity. It will only load if it is actually missing members and does not overwrite existing members.

Declaration
Task<bool> LoadMembersAsync(IPropertyLoadOption propertyLoadOption, IRelationLoadOption relationLoadOption)
Parameters
TypeNameDescription
IPropertyLoadOptionpropertyLoadOption

Properties to load.

IRelationLoadOptionrelationLoadOption

Relations to load.

Returns
TypeDescription
Task<System.Boolean>

true if new members were added on the current entity.

Remarks

Culture sensitive properties will only be loaded in the current cultures. Lazy loading is only possible on entities that are not new.

LoadPropertiesAsync(IPropertyLoadOption)

Loads the specified properties on the current entity. It will only load if it is actually missing properties and does not overwrite existing properties.

Declaration
Task<bool> LoadPropertiesAsync(IPropertyLoadOption propertyLoadOption)
Parameters
TypeNameDescription
IPropertyLoadOptionpropertyLoadOption

Properties to load.

Returns
TypeDescription
Task<System.Boolean>

true if new properties were added on the current entity.

Remarks

Culture sensitive properties will only be loaded in the current cultures. Lazy loading is only possible on entities that are not new.

LoadRelationsAsync(IRelationLoadOption)

Loads the specified relations on the current entity. It will only load if it is actually missing relations and does not overwrite existing relations.

Declaration
Task<bool> LoadRelationsAsync(IRelationLoadOption relationLoadOption)
Parameters
TypeNameDescription
IRelationLoadOptionrelationLoadOption

Relations to load.

Returns
TypeDescription
Task<System.Boolean>

true if new members were added on the current entity.

Remarks

Lazy loading is only possible on entities that are not new.

SetPropertyValue(String, CultureInfo, Object)

Sets the value of specified culture sensitive property.

Declaration
void SetPropertyValue(string name, CultureInfo culture, object value)
Parameters
TypeNameDescription
System.Stringname

Property name.

CultureInfoculture

Culture of the value

System.Objectvalue

Property value.

Exceptions
TypeCondition
PropertyNotFoundException

When the property does not exist or was not loaded.

SetPropertyValue(String, Object)

Sets the value of specified culture insensitive property.

Declaration
void SetPropertyValue(string name, object value)
Parameters
TypeNameDescription
System.Stringname

Property name.

System.Objectvalue

Property value.

Exceptions
TypeCondition
PropertyNotFoundException

When the property does not exist or was not loaded.

この記事を改善するための提案がある場合は、 お知らせください!