Previous Article about ASP. NET mvc4ArticleUsing ajax in ASP. NET mvc4 is also an example of a message board, which describes how to use Ajax on the mvc4 platform. Http://www.keleyi.com/a/bjac/781ba7719ce323f.htm
Based on the above example, this article adds data storage access, using the currently popular Entity Framework technology.
Keleyi is a simple message board and a good example of learning ASP. net mvc. The database uses SQL Server. The project adopts a layered architecture and MVC model. The data access technology uses Entity Framework, and the front-end uses Ajax andProgramBackground interaction,Source codeDownload downloads from http://keleyi.codeplex.com.
The keleyi project can run with Visual Studio 2010 (mvc4 installed), or Visual Studio 2012 open, the installation method can refer to: http://www.keleyi.com/a/bjac/2916901353b081f1.htm
Currently, the keleyi project uses mvc4 of. Net 4.0 to Implement Message submission and background Message Management (public or hidden messages) at the front end. This instance is also updated. For more information, visit the http://www.keleyi.com
Yes run:
The following section describes how to access the database using Entity Framework.Code:
Using System. componentmodel. dataannotations. Schema; Using System. Data. entity. modelconfiguration; Namespace Keleyi. com. efdal. Models. Mapping { Public Class Keleyi_messagemap: entitytypeconfiguration <keleyi. com. model. messageinfo> { Public Keleyi_messagemap (){ // Primary Key This . Haskey (t =>T. Kid ); // Properties This . Property (t => T. kcontent). hasmaxlength ( 2000 ); This . Property (t => T. ktitle). hasmaxlength ( 100 ); This . Property (t => T. kemail). hasmaxlength ( 100 ); This . Property (t => T. KQQ). hasmaxlength ( 50 ); // Table & Column mappings www.keleyi.com This . Totable ( " Keleyi_message " ); This . Property (t => T. Kid). hascolumnname ( " Kid " ); This . Property (t => T. kaddtime). hascolumnname ( " Kaddtime " ); This . Property (t => T. kcontent). hascolumnname ( " Kcontent " ); This . Property (t => T. ktitle). hascolumnname ( " Ktitle " ); This . Property (t => T. kemail). hascolumnname ( " Kemail " ); This . Property (t => T. KQQ). hascolumnname ( " KQQ " ); This . Property (t => T. kisshow). hascolumnname ( " Kisshow " );}}}
This article forwarding from Ke leyi: http://www.keleyi.com/a/bjac/4064796bf1f324c8.htm