Upgrading to WebMatrix SimpleMembership - asp.net-mvc-4

I installed MVC 4 when it was in beta, so I didn't get the SimpleMembership library back then. Now I've built a large project using the old MembershipProvider and was wondering how to upgrade from that to WebMatrix SimpleMembership.
I've already created the database schema and EF model and mapping classes. Now I'm wondering how I can upgrade the rest (install required libraries, etc.)
Is there some upgrade path I can follow, just to bypass screwing up my project?

Here is the upgrade path I used:
Backup everything (Code and SQL)
Create a new Internet Application [with SimpleMembership]
Move following folders from old project to new project:
Scripts
Content
Images
Controllers [don't overwrite AccountController]
Models [don't overwrite AccountModels]
Views
Insert connectionString from old project into Web.config
Run project and create a new user. Then the SimpleMembership SQL tables will be created automatically.
Use Entity Framework Power Tools, right click on project and choose Entity Framework -> Reverse Engineer Code First, to generate all EF entity/mapping classes for all SQL tables.
Delete UserProfile entity and UserProfileMap classes, because they come with SimpleMembership's AccountModels.
Refactor GUID to integer in all project.

Related

no option for database templates in new item window

I'm creating asp.net core web application and there'is no database templates in new item window. I've installed "Data storing and processing", "Entity framework 6 tools". I'm actually want to create ADO.net template, but it seems to be I need to install something for any database templates to appeared
ADO.net template is removed in Asp.Net core.And NET Framework, as Entity Framework 6 doesn't support . NET Core.So you should use Entity Framework Core rather than Entity framework in Asp.net core.
If you want to use Entity Framework Core with an Existing Database in Asp.net core,you can refer to the official tutorial.
That looks like normal behavior. In .NET Core you'll need to use Entity Framework Core. If you're trying to reference an existing database, you'll need to scaffold it as they've done away with EDMX models in EF Core. Here's how:
If you don't have it already, install the Microsoft.EntityFrameworkCore.Tools NuGet package and any other EF Core packages you think you might need. For example, if you're developing against SQL Server, install the Microsoft.EntityFrameworkCore.SqlServer package.
Run the scaffolding command in the VS Package Manager Console for the database you're trying to add. Something like the following, although you'll want to read the documentation first to determine the parameters you need:
Scaffold-DbContext 'Data Source=(local);Database=MyDB;Trusted_Connection=True' Microsoft.EntityFrameworkCore.SqlServer
This will create a context class for your database that you can then reference throughout your project.

.Net Core - referencing another project in solution prevents System and other dependencies from being recognised

I have a solution that contains a number of projects, one is an API, the other is an admin portal.
I'm trying to create another project inside the solution to hold all shared components such as database entities so they can be shared between the API and the Admin Portal.
I've created a new project called 'Common' and selected to use netcoreapp2.2 because if I just select a standard class library then annotations on the Entities don't work.
When I reference the 'Common' project from the 'API' project, which is also netcoreapp2.2, Rider(Mac) is unable to recognise any of the standard packaged used with the project such as System and System.Linq (and many others).
My experience with .Net Core is limited to only this project, so I'm sure I'm doing something wrong, I just can't figure out what it is.
I managed to fix this, I removed the 'Common' project from my solution and re-created it this time selecting the create the project as a Web Application.

ASP.NET Core 1.1 Identity dependencies and all Data Access in a separate class library project

I have extracted most of the Database related code from an ASP.NET Core Web Application project with Individual User Accounts, ie. Identity into an ASP.NET Class Library project. I am now stuck in the final pieces which is to remove the concrete assignment to EF Core and moving the connection strings to the Data project.
Here is what I have done so far:
Created a blank solution
Created an ASP.NET Core web
application (TestPatterns.Web) with Individual User Accounts
Updated all the Nuget packages
Created a Class Library Core
package
In the Class Library Project (TestPatterns.Data) Nuget ->
Removed the NetStandard Library 1.6, replaced with
Microsoft.NetCore.App 1.1.0
In the Class Library Project (TestPatterns.Data), added all the EF and
Identity Nuget Packages
Moved over of the 'Data' folder from the
Web application to the class library project
Moved over the
ApplicationUser.cs file from the Web Application to the class
library project folder Models
I end up with a structure like this:
To run a migration I execute the following on the Data project folder:
dotnet ef --startup-project ../TestPatterns2.Web migrations add first
Looking for some help on removing all dependencies of EF Core 1.1 from the Web project and moving the connection strings over. Also, would the DI remain in the Web project or should that move to the Data project also? If so, how?

Code generator tools for creating UOW and Repository classes for Entity Framework 4?

I am using Visual Studio 2010 with MVC 4 installed along with Entity Framework 4. Is there any development tools to generate repository and uow classes for EF4? There is an EF4 DBContext generator, but did not see anything else for the dated EF4.
There is a NuGet package I created:
https://www.nuget.org/packages/RepositoryGenerator/
This is targeted to EF6 but it should give you a good starting point, it's a lot easier to change a few statements for EF4 compatibility then to create one from scratch. I'm also working on supporting EF4 in the future.

Can I use Nuget to install MVC 4 into Webforms, or is it better to merge MVC config into Webforms, for incremental conversion

Times have changed--now we have Visual Studio 2012, MVC 4, Nuget--and it seems like the procedures in the Hanselman blog and the more recent Channel 9 tutorial could be enhanced. Both Hanselman and Kane recommend using DIFF tools to merge MVC functionality into the Web Forms Project (to endow the webform's .csproj and web.config etc with MVC). However now that Nuget manages packages, I wonder if it would be easier to merely install MVC 4 into the Web Forms project using Nuget; while of course following the procedures in the blog and the channel 9 demo for incrementally upgrading the Webforms project, including dealing with aspx login controls that postback, ascx user controls, and changing base classes Page to ViewPage and MasterPage to ViewMasterPage.
Has anyone tried to use Nuget to endow a Webforms project with MVC 4, and if so, would you recommend that technique?
UPDATE
I am following the Kane method which is an ordered set of guidelines (like modifying a complicated recipe in cooking) and am using NuGet to avoid some tedium. The guideline requires you make a dummy MVC project and compare it to your ASP.NET project to see what you need to add to your original project. You can add stuff using NuGet GUI, but that gets you latest stable assemblies versions which may lead to the dark insane demon of incompatibility. Instead use the NuGet console command line to get the compatible versions listed in the dummy MVC project's packages.config as explained in the following: How to install an older version of package via NuGet?