Class WMAssetDirectory
Class providing directory type behavior to IWMAsset
Implements
Inherited Members
Namespace: Quantellia.WMServer.Asset.Directory
Assembly: WMServer.dll
Syntax
[HasDTO(typeof(WMAssetDirectoryDTO))]
public class WMAssetDirectory : WMAssetBase, IWMAsset, IDbEntity, IWMEntity, IDocumentedEntity, INamedEntity, IWMAssetDirectoryMember, IWMPrincipalOwned
Constructors
WMAssetDirectory()
Parameterless Constructor. Will populate a random GUID as ID
Declaration
public WMAssetDirectory()
WMAssetDirectory(string)
Constructor that specifies ID
Declaration
public WMAssetDirectory(string ID)
Parameters
Type | Name | Description |
---|---|---|
string | ID |
Properties
Members
A list of members directly under this WMAssetDirectory in the asset hierarchy.
Declaration
public IEnumerable<IWMAssetDirectoryMember> Members { get; set; }
Property Value
Type | Description |
---|---|
IEnumerable<IWMAssetDirectoryMember> |
Remarks
Note that this is not automatically populated in WMAssetDirectoryDTO.UpdateModel(DbContext, object[]?), as that would results in a cascade of expensive database evaluations whenever any WMAssetDirectory is created. Instead it is provisionally populated only when hierarchy members need to be available, up to a depth arguments, for Get(int)
RootDirectory
Provisional Root WMAssetDirectory
Declaration
public static WMAssetDirectory RootDirectory { get; set; }
Property Value
Type | Description |
---|---|
WMAssetDirectory |
RootID
The ID associated with RootDirectory.
Declaration
public static string RootID { get; }
Property Value
Type | Description |
---|---|
string |
Remarks
This value is defined in the software and is the same for all instances. Unlike the user-defined directories, the root directory does not have user-defined metadata. Consequently, the root directory is created in memory when the software is running, but there is no persistent record in the database. The in-memory root record always has ID:
c8051982-f490-43b7-92a1-29efe2efd4a6
SeparatorString
The separator used between names in the FullPathName. (i.e. A/B/C/D)
Declaration
public static string SeparatorString { get; }
Property Value
Type | Description |
---|---|
string |
Methods
DeleteDirectoryTree(WMPrincipal, string, WMAppDbContext)
Deletes all database rows with a hierarchical parent indicated by dir
(including the parent).
Declaration
public static Task DeleteDirectoryTree(WMPrincipal principal, string dir, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The principal of the asset directory located at |
string | dir | The path indicating the parent. |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task |
Get(WMPrincipal, string, WMAppDbContext)
Returns a WMAssetDirectory with id
if exists, otherwise throws an exception.
Declaration
public static Task<WMAssetDirectory> Get(WMPrincipal principal, string id, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | |
string | id | The ID of the WMAssetDirectory |
WMAppDbContext | context | The context |
Returns
Type | Description |
---|---|
Task<WMAssetDirectory> |
Get(WMPrincipal, string, int, WMAppDbContext)
Gets a listing of the specified WMAssetDirectory to the recursion depth specified.
Declaration
public static Task<IEnumerable<WMAssetDirectory>> Get(WMPrincipal principal, string dir = null, int recursionDepth = 0, WMAppDbContext dbContext = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The principal of the Asset Directory being requested. |
string | dir | Specification of the directory to retrieve |
int | recursionDepth | Depth to which the directory subtrees under the specified directory should be traversed. |
WMAppDbContext | dbContext | Optional reference to a WMAppDbContext instance. |
Returns
Type | Description |
---|---|
Task<IEnumerable<WMAssetDirectory>> |
GetMembers(WMPrincipal, string, int, WMAppDbContext)
Gets a listing of all IWMAssetDirectoryMember to the recursion depth specified.
Declaration
public static Task<IEnumerable<IWMAssetDirectoryMember>> GetMembers(WMPrincipal principal, string dir = null, int recursionDepth = 0, WMAppDbContext dbContext = null)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The owner of the Asset Directory being requested. |
string | dir | Specification of the directory to retrieve |
int | recursionDepth | Depth to which the directory subtrees under the specified directory should be traversed. Set to -1 to return the entire tree under this directory. |
WMAppDbContext | dbContext | Optional reference to a WMAppDbContext instance. |
Returns
Type | Description |
---|---|
Task<IEnumerable<IWMAssetDirectoryMember>> | All IWMAssetDirectoryMember's matching the query. |
GetPopulatedDirectoryTree(WMPrincipal, string, int, WMAppDbContext)
Evaluates the requested asset directory, and populates directory members for it, and for each child directory up to the depth arguments.
Declaration
public static Task<WMAssetDirectory> GetPopulatedDirectoryTree(WMPrincipal principal, string dir, int depth, WMAppDbContext dbContext)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The principal of the requested directory |
string | dir | The fullpathname directory, or ID of the requested asset directory |
int | depth | Depth to which the directory subtrees under the specified directory should be traversed. Set to -1 to return the entire tree under this directory. |
WMAppDbContext | dbContext |
Returns
Type | Description |
---|---|
Task<WMAssetDirectory> |
UpdateDirectoryTreePaths(WMPrincipal, string, string, WMAppDbContext)
Updates all database rows with a hierarchical parent indicated by oldPath
(including the parent) such that their position in the hierarchy is indicated by newPath
Declaration
public static Task UpdateDirectoryTreePaths(WMPrincipal principal, string oldPath, string newPath, WMAppDbContext context)
Parameters
Type | Name | Description |
---|---|---|
WMPrincipal | principal | The principal of the asset directory located at |
string | oldPath | The path indicating the parent. |
string | newPath | The location the parent is being moved to. |
WMAppDbContext | context |
Returns
Type | Description |
---|---|
Task |