Rename a Role in the Lightswitch -
Rename a Role in the Lightswitch -
how rename name of role in securitydata dataworkspace in lightswitch?
//lookup role, , rename it, or create 1 if none exist. var rolesquery = this.dataworkspace.securitydata.roles.where(r => r.name.startswith(oldrolenamestring)).execute(); role role = rolesquery.any() ? rolesquery.single() : this.dataworkspace.securitydata.roles.addnew(); role.name = "othername";
an invalidoperationexception thrown states "cannot set value of property 'name' because read-only."
so right way then?
renaming roles not possible. there's couple reasons this: 1. lightswitch bases role implementation on asp.net's membership/role scheme doesn't provide api rename roles. 2. name property cannot updated because primary key , lightswitch doesn't allow changing values of primary keys.
instead, you'd need delete role , add together new 1 replace it.
visual-studio-lightswitch
Comments
Post a Comment