aspnet_regsql tool created additional tables - asp.net

When i used aspnet_regsql tool on my mdf file it created by two copies of some tables. For example UsersInRoles and aspnet_UsersInRoles, Users and aspnet_Users. What does it mean?

The aspnet_regsql tool is used to create an application services database. In this database it will create memebership tables like the ones you mentioned in your question. It is used to store users and user roles, etc, that can be used with the asp.net memebership functionality. Please see:
http://msdn.microsoft.com/en-us/library/yh26yfzy(v=vs.100).aspx
Kleinkie provided a good link too.
You said it copied two copies of some tables, did you mean two tables with identical names under different schemas? I wasnt aware this was possible with aspnet_regsql.
It is best to utalise these tables with the asp.net memebership modules.

Related

ASP.NET membership provider database combination with site database

i have ASP.NET website with ASPNETDB.MDF database from default providor.
i have also MainDB.MDF that contains all other site database.
i want to combine ASPNETDB.MFD into MainDB.MDF in order to have only one DB.
is it possible?
if yes what are the disadvantages of this combination?
The only theoretical disadvantage is that you may want to run several apps with shared users. Then it would be better to have external provider. Most people don't do that of course then it is better to have data and users in the same database to make deployment and backup easier.
To achieve this just run the asp.net regsql tool against your database and it will create the tables. Then have just one connection string to your database and you are done.

EF6 Code First. ASP Identity security in different database

I have to have my security in a different database, because multiple applications use the same security database.
I want to be able in one of my models in a project to reference a user virtually. I can't do this however, since it would create a foreign key relationship over different databases, which is impossible.
I also have a common configuration database where several applications use the same config tables, and have the same problem for the same reason.
What's my best move in this situation?
Thank you.

ASP.NET automatically generated Provider tables

I have the following database schema (in the early stages at the moment):
Everything on the right is created by the ASP.NET Provider model. They were a bunch of automatically generated tables that were created the first time that I used the login controls.
Now, I've settled for the moment in using this schema and extending it with my own tables. I'm not looking to implement any custom Providers at the moment.
My question is, can I delete the Profiles and _MigrationHistory tables?
I'm not using the Profile Provider
I'm only using the Role and Membership Providers
Will I break the Internets if I simply get rid of the Profiles and _MigrationHistory tables?
EDIT: The Profiles Provider is disabled in web.config.
The Interwebs do not break if I delete those tables. As long as no Profile Provider is used, the tables can still be used and accessed as they normally would be. They are not regenerated and no functionality is lost. The Membership/Profile/Role Provider tables can be extended or modified (as long as constraints are kept in check) or, as I was wondering, deleted.

ASP.NET: Questions about ASPNETDB.MDF

in my web site i have two databases, ASPNETDB.MDF and a self created one (database.mdf). (The don't contain a lot of data yet)
But i need a relationship (foreign key) between a table in ASPNETDB.MDF and a table in database.mdf.
So i guess i need to merge both databases first, would you just extend the "ASPNETDB.MDF" with the tables from "database.mdf" ?
or better configure "database.mdf" for the asp.net Applicatoin Services and then delete "ASPNETDB.MDF" ?
Is "ASPNETDB.MDF" even meant to be used in a production online web application?
(Right now i'm using sql server express but i will probably use sql server when deploying Site to a shared host)
thanks a lot for answers
the scripts for the structure that is inside ASPNETDB.MDF are deployable on a different database (http://msdn.microsoft.com/en-us/library/x28wfk74.aspx)
however, I would really consider wether or not you want to do a foreign key to those tables, the membership, roles and profile API is intended to be used as a pluggable API, something you will break by defining your foreign key
Setting up membership in existing database is something you should be looking at. If you are asking me, I will and I have created membership related data objects in my application specific database. You can find the SQL scripts to do so at C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727(v4.0.30319 in case you have VS 2010).
By doing this you can create foreign keys to membership table and achieve your objective.

If i use a separated ASP.NET Membership database how should i handle the relations to the user tables?

If i use a separated ASP.NET Membership database what is the correct way to define the relations between the user tables and application data tables?. Should i create copies of the user tables and sync? or is ok to just create the Guid columns and enforce validation in the application code?, Are there any issues with performance that i should be aware of when separating databases?
You can Create two database , one for Membership control and other for Web-site use.
I have Many sites which are running on same concept. No need to worry. web-site will be fast and secure.
If you want to learn more on this or want a live demo then download a classified starter kit for asp.net
Just make the join on databases(with double dots) when you need data.
No need to change, just handle the userid, role etc but need to create two different connection string in your app.
OR Copy the tables in your original db

Resources