Posts

Showing posts from November, 2016

EntityFramework and Migration with database

 <connectionStrings>     <add name=" MainModel " connectionString="server=Localhost;database=dbMVCProject;Integrated Security = true;" providerName="System.Data.SqlClient"/> </connectionStrings> after adding your connection string in web.config  Open  Package Manager Console write : Install-Package EntityFramework After installation... Create the Class of collection of database tables In Class "MainModel". MainModel.cs ------ start ----------- using System.Data.Entity; // This for DbContext using System.ComponentModel.DataAnnotations; // this for DataAnnotations namespace MVCProject.Models {     public class MainModel : DbContext     {         public DbSet<tbl_product> tbl_product { get; set; }         public DbSet<tbl_SliderMaster> tbl_SliderMaster { get; set; }     }     public class tbl_product     { ...

EntityFramework and Migration with database

 <connectionStrings>     <add name=" MainModel " connectionString="server=Localhost;database=dbMVCProject;Integrated Security = true;" providerName="System.Data.SqlClient"/> </connectionStrings> after adding your connection string in web.config  Open  Package Manager Console write : Install-Package EntityFramework After installation... Create the Class of collection of database tables In Class "MainModel". MainModel.cs ------ start ----------- using System.Data.Entity; // This for DbContext using System.ComponentModel.DataAnnotations; // this for DataAnnotations namespace MVCProject.Models {     public class MainModel : DbContext     {         public DbSet<tbl_product> tbl_product { get; set; }         public DbSet<tbl_SliderMaster> tbl_SliderMaster { get; set; }     }     public class tbl_product     { ...