Hi,
I read the book and tried to develop a site based on my blog database. I tried to implement the Entity Model in my design, but when I upload my files to the server, I get an error saying the namespace for my Model is not found. Below is a detail of the error I am getting.
Quote:
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0246: The type or namespace name 'MPBlogDBModel' could not be found (are you missing a using directive or an assembly reference?)
Source Error:
Line 5: using System.Web.UI;
Line 6: using System.Web.UI.WebControls;
Line 7: using MPBlogDBModel;
Line 8:
Line 9:
Source File: d:\hosting\8577425\html\mohamedpussah\Default.aspx .cs Line: 7
|
In my project, I have a database called mpblogdb and I added an entity model I named MPBlogDBModel. The model is based on the database that has only one table, The CourseTable with four columns.
Below is the code I wrote in the code behind of my page:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MPBlogDBModel;
public partial class mohamedpussah_Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void submitButton_Click(object sender, EventArgs e)
{
mpblogdbEntities myEnt = new mpblogdbEntities();
CourseTable myCourse = new CourseTable();
myCourse.Title = titleTextBox.Text;
myCourse.Body = bodyTextBox.Text;
myCourse.Comment = commentTextBox.Text;
myEnt.AddToCourseTables(myCourse);
myEnt.SaveChanges();
}
}
Can anyone tell me what am doig wrong?
Here is the connetion string I am using for the entity:
Quote:
|
<add name="mpblogdbEntities" connectionString="metadata=res://*/App_Code.MPBlogDBModel.csdl|res://*/App_Code.MPBlogDBModel.ssdl|res://*/App_Code.MPBlogDBModel.msl;provider=System.Data.Sq lClient;provider connection string="data source=mpblogdb.db.8577425.hostedresource.com; Initial Catalog=mpblogdb; User ID=******; Password=*******;multipleactiveresultsets=True;App =EntityFramework""providerName="System.Data.Entity Client"/>
|