ASP MVC 3, generation of tables fail - asp.net-mvc

Edited:
i'm trying to learn ASP MVC, but i'm having a problem, the Web Developer Express is failing to generate the database tables.
Please How i know where is the problem?
-
i'm just following the asp mvc website tutorial, and there the model class "make - create" the database + tables just pressing F5.... in my first tutorial all was perfect... but now i don't know what's happening
Thanks you guys :)

If you have already created a database you'll need to tell the app that you want to drop and recreate the tables when the database changes. Try adding this to Global.asax
System.Data.Entity.Database.SetInitializer(new System.Data.Entity.DropCreateDatabaseIfModelChanges<YourApp.Models.YourAppContext>());

Related

Is Grid.MVC compatible with ASP.NET MVC 5?

Before I start messing around with something that doesn't work:
Does Grid.MVC work with ASP.NET MVC 5?
On gridmvc.codeplex.com they just write MVC3/4, but I wonder if anybody tried it with MVC5? You tried it, but it didn't work?
Try this one: http://mvc-grid.azurewebsites.net
it is more up-to-date.
MVC 5:
Install-Package NonFactors.Grid.Mvc5
MVC 6:
Install-Package NonFactors.Grid.Mvc6
Yes it works in MVC5. The website does not indicate 3+ but that's what it is.
I have implimented Grid.Mvc in multiple MVC5 projects using EF6.
I love it, it's really easy to stand up and allow my users to query the data tables. I would suggest trying it out, but the documentation isn't great. Luckily the documentation they do have is enough to get started.
https://gridmvc.codeplex.com/documentation

asp.net mvc database first .cs files not generated

I have an existing Access database and need to build a REST api. The best way I thought is to migrate it to SQL server and build an asp.net mvc web api. But I'm a complete noob in EF... I tried database first following this. But EF didn't seem to generate any .cs classes..or .tt files.
The only file I got is .designer.cs.
Any help is greatly appreciated..

How to implement Login using Membership provider into MVC 4 application ?

I want to implement login/change password/forget password into MVC 4 Application.
Can any one guide me how i could achieve this using Membershiop in MVC 4?
** This type of open ended question are normally down voted. You need to be more specific with the problem you are facing and share your analysis. **
I will try to give you some pointer if you have not already figure out from a simple google search.
You can use SimpleMembershipProvider if your are using MVC 4. If you create a new MVC 4 application in Visual Studio, you will get a precooked working form authentication enabled internet application.
Go through the code in AccountController, you will find most of the functionality already implemented with the help of WebSecurity wrapper class. Go from there and share specific issue you face.
You can refer following two links to start with:
http://www.codeguru.com/csharp/.net/net_asp/mvc/using-simplemembership-in-asp.net-mvc-4.htm
http://www.codeproject.com/Articles/689801/Understanding-and-Using-Simple-Membership-Provider

Entity framework not working after adding a column in database

In my MVC 4.0 and EF application I have added a new column in the database - updated Model from database in the edxm file. Made some changes in the controllers, build and published the site again. Also added the same column in the database on web server. After deploying the changes the insert code is not working. Its all working fine locally and I m not getting any error on the server and don't know how to go about troubleshooting this. Any ideas? thanks
Maybe it is silly but did you remember to change connectionstring ?

Entity Framework 6.0 Code First Migrations to Azure SQL DB not working.

I am trying to create an ASP.NET MVC site loosely based on this tutorial.
http://www.windowsazure.com/en-us/develop/net/tutorials/web-site-with-sql-database/
I am using VS2013 preview which gave me the option to create an ASP.NET MVC 5 site. Also, using the following packages:
EntityFramework 6.0.0-rc1
Microsoft.AspNet.Identity.Core" 1.0.0-alpha1
Microsoft.AspNet.Identity.EntityFramework 1.0.0-alpha1
After configuring a website and associating it with a database in Azure, I proceeded to run the following commands in the package manager console:
enable-migrations -ContextTypeName IdentityDbContext
add-migration Initial
When I published to Azure with the database specified and the "Execute Code First Migrations" checkbox checked, the site deployed properly, but after inspecting my DB, the migrations didn't run. My migrations had been successful previously on a site with ASP.Net MVC 4 and EF 5.0.
I would guess the problem is that EF 6 is ignoring the connection string that is set during publishing, but I cannot understand why.
Any help would be appreciated. Thank you.
This guide looks comprehensive: http://www.asp.net/mvc/tutorials/getting-started-with-ef-using-mvc/migrations-and-deployment-with-the-entity-framework-in-an-asp-net-mvc-application
The key part being "Execute Code First Migrations (runs on application start)"
I hope that helps.
When I faced this, I needed to change the connection string to point to the Azure DB instead of the local SQLLite DB.

Resources