For an ASP.NET membership provider and role implementation in the Entity Framework, you must import all ASPNETDB views (membership databases) in an EDMX file. e.g. vw_aspnet_MembershipUsers, vw_aspnet_Roles, vw_aspnet_UsersInRoles, vw_aspnet_Users, etc.
Membership will then be done through EF. In this way, you can provide a graphical interface using the following functions.
here is the controller code. eg.
// GET: /Membership/Edit/5 public ActionResult Edit(Guid id) { var recordToEdit = (from r in _db.vw_aspnet_Users where r.UserId == id select r).First(); return View(recordToEdit); } public ActionResult Index() { return View(_db.vw_aspnet_MembershipUsers.ToList()); }
Now, how to combine ASPNETDB with an existing database, make only one connection string in web.config. (Your question: why don't I have only one?)
It is also possible using the following steps.
ASPNETDB.MDF is a membership provider database and is used to store and retrieve membership data from a database, and here we will see how to create a membership provider database. The command used to create Aspnetdb.mdf is ASPNET_RegSQL.EXE
1.Start-> Programs-> Microsoft visual studio 2005-> visual studio tools-> Visual Studio 2005 Command Prompt. Enter ASPNET_RegSQL.EXE at the Visual Studio command prompt
A wizard will be displayed with the heading "Welcome to the Spl Asp.Net Server Wizard." Here you need to click "Next"
Next, a wizard appears with the option "Select a setting". Now we need to select the "Configure SQL Server for Application Defaults" setting option. Choose the one you want and then.
A window with "Select Sql Server Database" will be displayed. Now we need to select our SQL server database. Here you need to install the server, authentication type and database. If you select the default name "aspnetDb.mdf", it will be selected. If you want to modify an existing database, select this database.
5. A confirmation message with the heading “Confirm Settings” will now be displayed. Now check the server name and database name and click Next.
- A window appears with "Database Created or Modified." Now click Finish
Be careful in the above steps, you need to select an existing database. Some tables (11+), views, stored membership procedures and roles will be added to your existing database ....
Enjoy ... Thanks ...
Amit prajapati
source share