Monday, March 3, 2014

Help file builder in C Sharp projects using Sandcastle help file builder



Sandcastle help file builder is a nice tool to generate a help file our projects. In this blog I will explain, how to simply generate the help files for projects

STEP 1:
Create a new C# class library project and add a simple method called save() and before the method we put  three slash(///), It will automatically generate a XML comments like
 /// <summary>
        ///
        /// </summary>
        /// <param name="id"> </param>
        /// <param name="name"> </param>
        public void Save(int id, string name)
        {
           
        }
We will add comment for this method like below
 /// <summary>
        /// this method is used to save the user information’s
        /// </summary>
        /// <param name="id">this props holds id of the user</param>
        /// <param name="name">this props holds name of the user</param>
        public void Save(int id, string name)
        {
           
        }

STEP 2:
Go to solution explorer -> right click-> click properties ->click the build tab
And check the XML documentation file check box shown into below image(click the image shown in popup for clear visible)


Finally rebuild the solution it will automatically generate a XML file
STEP 3:
Install the sandcastle Help File Builder and Tools. Go to the below link download the tools, install in to your system http://shfb.codeplex.com/  and open the tool
STEP 4:
Go to file menu -> click the new project ->give the file path and click the save button
The screen look like (click the image shown in popup for clear visible)



Fill the help file name, presentation style, copyright URL, feedback email address and etc…
Look at the right upper corer  we look at the menu project explorer,  right click the project explorer and add project  reference( which project we want generate helper file)  and documentation resource  (refer step2).
Finally we go documentation menu and build the projects, it will generate the Help file like (click the image shown in popup for clear visible)


Awesome help file will be ready ….. Thanks






Wednesday, May 29, 2013

Simple Membership MVC4


Simple Membership

The Asp.Net MVC 4 introduced the many new features one of the main features is SimpleMembership. SimpleMembership is also support for Outh. SimpleMembership has been designed as an advanced of previous ASP.NET Role and Membership provider system.
Whenever we create a new MVC 4 project, Simple Membership is automatically implemented and the related views, models and controllers are also automatically generated. Let‘s we look at this bellow image.








WebSecurity


Simple membership provides the new class called WebSecurity. MSDN definition (“Provides security and authentication features for ASP.NET Web Pages applications, including the ability to create user accounts, log users in and out, reset or change passwords, and perform related tasks.”-MSDN).
In the class have SimpleMembership related methods are there, I would explain some basic methods and how to use in our projects.

1) Login

WebSecurity.Login(UserName,Password, persistCookie:RememberMe)

The login method to check the given user is authorized person or not, it has three parameters Username-The User Name, Password-The user password, and persistCookie- It is (Optional) true to specify that the authentication token in the cookie should be persisted beyond the current session; otherwise false. The default is false.

1) LogOut

WebSecurity.Logout();

The logout method is used to clears all authentication cookies from the cookie cache in other words to disconnect the user

3) Create Account

WebSecurity.CreateAccount(userName, password, requireConfirmationToken = false);
WebSecurity. CreateUserAndAccount(userName, password, propertyValues = null, requireConfirmationToken = false);
If our application wants more detail about the user we will use CreateUserAndAccount method otherwise we use Create Account
The bellow image shows the all other methods of web security




Roles  

SimpleMembership provides another one class named as Roles. . MSDN definition” Manages user membership in roles for authorization checking in an ASP.NET application. This class cannot be inherited.”
In the class have Role based methods are there, I would explain basic methods and how to use in our projects.

Roles.CreateRole("RolesName");
 The method has been used to add a new role the database. It has single parameter named as rolename.
2)DeleteRole
Roles.DeleteRole("rolename");
The method has been used to Removes a role from the data source. . It has single parameter named as rolename.
The bellow image shows the all other methods of websecurity roles


Database structure


Simple membership uses the entity framework model first approach whether when we execute the application it would be automatically create the database and tables. Let we see the tables
1)      UserProfile-It is a extension table for users.
2)      webpages_Membership-User security related data’s are their like “password , password salt etc”.
3)      webpages_OAuthMembership- Outh related information’s  stored in this table.
4)      webpages_Roles- The roles are stored like(“Admin, Editor etc..”).
5)      webpages_UsersInRoles- which user have which role that informations are stored this table.


Conclusion

In this article I simply explained how to use SimpleMebership, it’s only for beginners