Posts

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

Knockout.js binding syntax bind to root, self, current context

When using knockout.js  if your ViewModel is an array and you want to bind to the entire ViewModel, the syntax to bind to the ViewModel root, when the root is the current context: <ul data-bind="foreach: $data"> <li> <p data-bind="text: SomeTextProperty"> </p> </li> </ul> The XAML syntax equivalent when the DataContext is an array: <itemscontrol ItemsSource="{Binding Path=.}"> ... </itemscontrol> Hope this helps, Aaron

ASP.NET MVC 4 SimpleMembershipProvider, WebMatrix WebSecurity CreateUserAndAccount Create New User 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 WebMatrix.WebData.WebSecurity.CreateUserAndAccount() method is called: Text below in bold is dynamic and represents the UserName and Password properties passed to the CreateUserAndAccount() method as well as the UserId generated as part of user creation. Similarly, the name of the UserId and UserName columns, and the name of the UserProfile table may also be different based on your specific configuration. exec sp_executesql N'SELECT [UserId] FROM [UserProfile] WHERE (UPPER([UserName]) = @0)',N'@0 nvarchar(23)',@0=N' UserName ' exec sp_executesql N'INSERT INTO [UserProfile] ([UserName]) VALUES (@0)',N'@0 nvarchar(23)',@0=N' UserName ' exec sp_executesq