ASP.NET MVC 4 SimpleMembershipProvider, Web Security Roles Create Role SQL, Delete Role SQL

----------------------
ASP.NET MVC 4 Membership Overview: http://aaron-hoffman.blogspot.com/2013/02/aspnet-mvc-4-membership-users-passwords.html
----------------------

Using SQL Profiler, below is the SQL that is executed when the ASP.NET MVC 4 SimpleMembershipProvider's System.Web.Security.Roles.CreateRole() method and DeleteRole() method are called:

Text below in bold is dynamic and represents the RoleName property passed into the CreateRole() method (or the RoleId associated with the RoleName).


Roles.CreateRole("RoleName");


exec sp_executesql N'SELECT RoleId FROM webpages_Roles WHERE (RoleName = @0)',N'@0 nvarchar(8)',@0=N'RoleName'



exec sp_executesql N'INSERT INTO webpages_Roles (RoleName) VALUES (@0)',N'@0 nvarchar(8)',@0=N'RoleName'


Roles.DeleteRole("RoleName");

exec sp_executesql N'SELECT RoleId FROM webpages_Roles WHERE (RoleName = @0)',N'@0 nvarchar(8)',@0=N'RoleName'


exec sp_executesql N'SELECT * FROM webpages_UsersInRoles WHERE (RoleId = @0)',N'@0 int',@0=2


exec sp_executesql N'DELETE FROM webpages_Roles WHERE (RoleId = @0)',N'@0 int',@0=2

Comments

Popular posts from this blog

Search iPhone Text Messages with SQLite SQL Query

How to Turn Off Microsoft Arc Touch Mouse Scroll Sound Vibration

Configure SonarAnalyzer.CSharp with .editorconfig, no need for SonarCloud or SonarQube