Interface IWMResource
Interface implemented by WMServer objects that comprise resources managed by access control. In particular every IWMResource derived type must implement ResourceDefinition(), which defines the particular resource and operations the derived type requires, and is called via reflection during database seeding to ensure that every IWMResource derived type in the application has database rows for all required resources and operations.
Namespace: Quantellia.WMServer.Auth.Model.UserAccess
Assembly: WMServer.dll
Syntax
public interface IWMResource
Remarks
The database will only be seeded when appsettings.json has the following entry
"SeedDB": true
This is to prevent concurrency issues with multiple WMServer instances starting up at the same time and attempting to add rows to the database, as well as reducing the startup overhead when no new operations or resources need to be added to the database. Even if nothing needs to be added to the database, seeding is an extremely heavy operation, since it has to query for the existence of every resource, operation, and permission needed to ensure smooth operation.
Properties
ResourceDefinitionMap
Maps each IWMOwnableResource derived type to the resource definition it supplies, if any. Caches the result to ensure the operation that retrieves the definitions, which is invoked through reflection, only ever happens once.
Declaration
public static Dictionary<Type, WMResourceOperationsDefinition> ResourceDefinitionMap { get; }
Property Value
Type | Description |
---|---|
Dictionary<Type, WMResourceOperationsDefinition> |
Methods
ResourceDefinition()
The resource operation definition that comprises this IWMOwnableResource. During database seeding on application load, each derived type will have their definition queried and dynamically added to the database, if not already present. The purpose of this routine is to reduce the overhead of adding new assets and resources to the application, which would otherwise require maintenance of an SQL seeding script and of every database that is affected by the new resource.
Declaration
public static WMResourceOperationsDefinition ResourceDefinition()
Returns
Type | Description |
---|---|
WMResourceOperationsDefinition |