Parichay

A Simple and Small Asp.Net MVC social networking, messaging engine.

Do you want to add the simple messaging, friends and group interaction to your website, but don't want to go for a complete CMS based solution? Are you using microsoft’s Asp.Net role based security and want to provide interaction between your website users? Or do you want to know the basics of social networking so that you can easily add them to your website if needed? Parichay is an attempt to help you address your intention.

Although Asp.Net Social Networking book is an amazing read, but still it carries a lot of information and the code contains quite a big (and of course efficient) framework for social network. In Parichay, we would try to Keep It Short and Simple(KISS)

Therefore, Parichay is a Short and Simple Asp.Net Social Networking and messaging website starter app. The application has been designed with KISS(Keep it Short and Simple) principle in mind. We will use Asp.Net MVC 3 (with razor) as web application framework. NHibernate will be used for data persistence framework - which will give our project the portability to several databases.

Of course, if you are looking for a well attested, well beaten track, you would prefer to go with a complete cms based solution, and add social networking to it as a plugin module. Still, this article will give you an Idea about what you mayconsider if you are develping your own social networking module. Further, this app can easily be converted into a CMS module as it has been designed as an independent module with least of dependencies to the security layer.

(Please Note:- This application doesn’t have one-click installer. Remember to go to the INSTALLATION section for information about installation. Basically - you'll need to:-
  • Create a database(e.g. create database parichaytest)
  • Create tables using SQLs provided (1ParichaySecurity.sql & 2ParichayData.sql)
  • Update the NHibernate connection string in Web.Config )

For more explanation, please read :- Parichay (A Simple & Small Asp.Net MVC Social Network Starter)

In addition to the default Asp.net role based security, we will be using another simple layer of permission based security - as a simple httpmodule (info. can be found here codeproject )

Installation
  • Please note that auto installer has not been created for this app. Kindly create the MySql Database first. e.g.- with name "parichaytest" and install the two SQL scripts provided.
  • The 1ParichaySecurity.sql contains the schema for Security.
  • 2ParichayMessaging.sql contains the schema for Messaging tables.
  • Change the name of NHibernate "connection string" in the web.config of the application to point to your database.
    • e.g., Enable & Update following settings for MySql Database in Web.Config file. (Update the DB name, Username, Password etc):-
       <property name="show_sql">true</property>
      <property name="use_outer_join">true</property>
      <property name="use_proxy_validator">false</property>
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>
      <property name="connection.isolation">ReadCommitted</property>
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="dialect">NHibernate.Dialect.MySQLDialect</property>
      <property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>
      <property name="connection.connection_string">Server=localhost;Database=parichaytest;User ID=**Your DB UserId**;Password=**yourdbpasswrd**;Convert Zero Datetime=true</property>
  • Enable & Update following settings for SQL Server in Web.Config file:-
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
      <property name="connection.connection_string">Data Source=.\sqlexpress;Initial Catalog=parichaytest;User ID=**Your DB UserId**;Password=**yourdbpasswrd**</property>
      <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>
      <property name="show_sql">true</property>

  • Build and run the application.
  • Remember to sign up with "sysadmin" username. The system will assign you the "Admin" role. Once the sysadmin is already created for you. You can comment out the following code block in the "Account>>Register" Controller action:-
if ((string.Equals(model.UserName,"sysadmin",StringComparison.InvariantCultureIgnoreCase))&&(Roles.GetAllRoles().Length == 0))
                    {
                        Roles.CreateRole("Admin");
                        Roles.AddUserToRole(model.UserName, "Admin");
                    }

  • The current system has been tested with MySql database. For other databases you can either generate the schema from mapping files. To do this, you will need following code in NHibernateHelper classes of "Parichay.Security" and "Parichay.Data" projects:-
cfg.Configure();
cfg.AddAssembly(typeof (aClassFromYourProject).Assembly);
new SchemaExport(cfg).Execute(false, true, false, false); 

Information can be found here and here

*After setting up the database, remember to update the NHibernate connection string in Web.Config file of the application.

Once I am able to test the application with different database, I will be updating the SqlScripts.

Last edited Feb 23, 2012 at 6:57 AM by okdone, version 7