Problem with display data from ActionResult Index()

Feb 27, 2012 at 9:20 PM
Edited Feb 27, 2012 at 9:21 PM

Hello

I add the following code how in the instructions:

 

PhoneShopEntities db = new PhoneShopEntities();
        //
        // GET: /Shop/

        public ActionResult Index()
        {
            var brandList = db.Brands.ToList();

            return View(brandList);
        }

 

And when i run the project, show error:

 

Unable to find the requested .Net Framework Data Provider.  It may not be installed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentException: Unable to find the requested .Net Framework Data Provider.  It may not be installed.

Source Error:

 

Line 16:         public ActionResult Index()
Line 17:         {
Line 18:             var brandList = db.Brands.ToList();
Line 19: 
Line 20:             return View(brandList);

 

I cant undestand why. Please Help.

Its my class DataExample:

 

public class SampleData : DropCreateDatabaseIfModelChanges<PhoneShopEntities>
    {
        protected override void Seed(PhoneShopEntities context)
        {
            var brands = new List<Brand>
            {
                new Brand { Name = "Nokia" },
                new Brand { Name = "Samsung" },
                new Brand { Name = "LG" },
                new Brand { Name = "Apple" },
                
            };

            

            new List<Make>
            {
                new Make { MakeName = "Iphone 3G", Brand = brands.Single(g =>g.Name=="Iphone"), Price = 4000000,  MakeUrl = "/Content/Images/iphone3g.gif" },
                new Make { MakeName = "6300", Brand = brands.Single(g =>g.Name=="Nokia"), Price = 1000000,  MakeUrl = "/Content/Images/nokia6300.gif" },
                new Make { MakeName = "i39", Brand = brands.Single(g =>g.Name=="LG"), Price = 900000,  MakeUrl = "/Content/Images/i39lg.gif" },
                new Make { MakeName = "s35", Brand = brands.Single(g =>g.Name=="Samsung"), Price = 4000000,  MakeUrl = "/Content/Images/s35samsung.gif" }
                
                
            }.ForEach(a => context.Makes.Add(a));
        }
    }

 

Cant undestand, why. Please, help.

P.S. Sorry for my bad english.