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.
Related
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.
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.
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.
I'm building a small ASP.NET MVC site where I want to use SQLite. While I already know how I will be connecting to the database (using DbLinq), I don't understand how to put the ASP.NET tables generated by aspnet_regsql.exe into an SQLite database.
I've used the regsql tool before with SQL Server, but never with SQLite. How do I create them for the SQLite DB?
One strategy that I think might somehow work is:
Use aspnet_regsql.exe to create the tables into an empty SQL Server database
Script all the objects in the database into T-SQL
Apply the T-SQL to the SQLite DB (how?)
Take a look at http://salient.codeplex.com
the Web.SQLite directory contains a drop in replacement for the default SQL providers.
It was a proof of concept that turned out ok. It uses EF, so is not as performant as it could be but should service low/medium traffic sites without issue.
You should be able to exclude all other files except that subdirectory and build it in isolation if desired. This will allow you to also trim the references.
Let me know if you have any issues.
You could try it with SQL Server Compact Edition 4 which is an embeddable SQL engine like SQLite but has an easier upgrade path if you need to grow it up to SQL Express or SQL Server.
Unfortunately the aspnet_regsql will not work with SQLite, so your strategy is essentially the correct approach. However, I would suggest looking at something like Roger Martin's Gallery Server Pro, which uses SQLite and already has the Membership, Role, and Profile provider tables scripted. You can make use of the script. See Roger's Code Project article from more information.
This question is about the tables created by aspnet_regsql for the ASP.NET 2.0 Membership database.
I am incorporating these tables and procs, etc from the database into my application database for ease of manageemnt and integration with the application data.
I notice that none of the tables have primary keys. This is a difficulty with the tools I use to create and manage entities, dto's, repository classes and validation.
Does anyone know why these tables do not have primary keys and whether adding primary keys to these tables will interfere with the operation of the baked-in stored procs that this database includes?
Thanks,
Kimball
Then something must have gone wrong with your installation - in my case, all the tables in "aspnetdb" have primary keys like any serious table should have:
Try removing aspnetdb and reinstalling...
Marc