Thursday, June 12, 2014

Always Add Two connection strings in ASP.NET Web.config

1) <add name="read" connectionString="Data Source=Test\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=false;uid=userid; password=password#123; Persist Security Info=True;" providerName="System.Data.SqlClient"/>

Use This Connection string for Read data from database

2) <add name="readandwrite" connectionString="Data Source=Test1\SQLEXPRESS;Initial Catalog=DatabaseName;Integrated Security=false;uid=userid1; password=password#1234; Persist Security Info=True;" providerName="System.Data.SqlClient"/>

Use This for Read and write data from and to database

3) With use of this performance will get better.

4)  TO get better Security

Tuesday, June 10, 2014

Best Site For ASP.NET Sample projects,code and developement

1) Go To http://www.packtpub.com/

2) In Menu -> Under Support -> Code Download and Errata

3) Select ASP.Net 4 social networking

4) Or you can download other projects

5) This projects are best you will really love it and you will enjoy it while coding

Configuration-Specific web.config Files

Managed Extensibility Framework

Managed Extensibility Framework:
Three core concepts with MEF:
1)      Export(s) : It exposes Contracts and contract like .NET Interface or Class or property
Code:
[Export(typeof(ICache))]
Public class Caching: ICache
{
               Public object Get(string cache_key)
{
               //Caching implementation
}
}
2)      Imports: Used to consume exported instances.
Code:
[Import()]
Private ICache cache;
3)      Catalog: hosts components that need to be composed.
Code:
Public static void Compose(object o)
{
               var container = new CompositionContainer(
                                             new DirectoryCatalog(Path.Combine(
AppDomain.CurrentDomain.BaseDirectory,
@”bin\MEFBin”)));
                              Var batch = new CompostionBatch();
batch.AddPart(o);
               container.Compose(batch);

}

Monday, June 9, 2014

Application Design - Layered Architecture

 Layered Architecture:
           1)      Presentation Layer - User Interface of application
           2)      Business Logic Layer – Rules of application
           3)      Data Access Layer – Responsible for connecting to data source and interacting with data that is stored in that location.
e.g. database, some XML files, text files or web service.  
4)   Utility /Components Layer – Mechanism of caching, logging errors, reading from configuration files.
Create independent project called Component layer   

           a)      Presentation layer – Web
           b)      Business layer – entities, business logic, components, interfaces
           c)      Data Layer – Entities, Data Access
           d)      Components Layer – Caching, logging, Configuration