XML Schema Used by Role Entity Data Source Provider
- Last UpdatedJun 10, 2024
- 2 minute read
A Role entity data source provider cannot exist on its own and needs to be associated always with a User entity data source provider. The reason being, the users who belong to the role have to be mapped to a user entity data source provider to be used in the system. The mapping between the role entity data source provider and user entity data source provider is achieved by maintaining the same instance name for the providers in the SKEntityDataSourceProvider table.
Now let us take a look at the Definition XML schema for the Role entity.
Role Entity Data Source Provider definition XML in SKEntityDataSourceProvider table will be as shown below.
<dataproviders>
<provider name="customsqlprovider" type="Custom Role Provider">
<properties>
<property name="Role" type="string" purpose="identifier"/>
<property name="RoleName" type="string" persist="true" persistcolumn="rolename"/>
</properties>
<datasource>
<datasource>server=localhost;database=SkeltaUsers;User Id=sa;pwd=XXX;</datasource>
<SourceTable>SqlUsers</SourceTable>
</datasource>
</provider>
</dataproviders>
The properties defined above are not used in any of the UI. To comply with the entity data source provider infrastructure this has been provided. One important thing to be taken care for Role entity data source provider is to ensure that the identifier value and Role Name getting persisted in SKVirtualRole database. If this is taken care by the code then there is no need for this definition XML. However the database connection string info can be useful. The type for the identifier property should be string and should always contain the Role name itself as the value. This is mandatory as the Role name itself is considered as unique identifier for the role provider. A sample for role provider value would be sqlproviderCustom::Admin (<Provider Instance Name> + "::"+ RoleName) here admin is the unique identifier value which is the role name.
Entity definition XML in SKEntity table will be as below.
<entity type="role"></entity>%%$#@@!!!*&
There are no properties defined at entity level as there is no UI, where the Role properties get listed. As the name implies the primary property provided by the Role provider is the Role name.