Best practice to integrate Asp.net Forms Authentication tables with my own domain tables? - asp.net-membership

I am creating a Asp.Net site which will accept users' registration/logon. The Asp.Net MVC automatically generate the following tables in a database with a strange name of aspnet-MyProjectName-20120705215524.
Is it possible to let Asp.Net Mvc generate the tables in my own database? (I have other tables which will refer the Users table). I will need the more columns in the table Users. Can I just manually add the columns to it? And I also want the extra columns show in the registration page.
Update
What's the best practice of integrating the system generated Users tables?
Memberships
Profiles
Roles
Users
UsersInRoles
CREATE TABLE [dbo].[Users] (
[ApplicationId] UNIQUEIDENTIFIER NOT NULL,
[UserId] UNIQUEIDENTIFIER NOT NULL,
[UserName] NVARCHAR (50) NOT NULL,
[IsAnonymous] BIT NOT NULL,
[LastActivityDate] DATETIME NOT NULL,
PRIMARY KEY CLUSTERED ([UserId] ASC),
CONSTRAINT [UserApplication] FOREIGN KEY ([ApplicationId]) REFERENCES [dbo].[Applications] ([ApplicationId])
);

Try the aspnet_regsql.exe tool this will generate the application services database for you
http://msdn.microsoft.com/en-us/library/ms229862(v=vs.80).aspx
You could add columns to the default database but I'm not on the effects of that, most of the app services use stored procedures so you could extend them

Related

How to create form/report on a table which has only primary keys?

Im trying to create a form with a report on a table that has only primary keys.
I have a table:
create table WRITE
(
author varchar(5) references AUTHOR (authorcode) ,
book varchar(20) references BOOK (bookid),
primary key(author,book)
);
I'm using APEX Application Builder to create a form on a table with report;
But When I get to the "Select the columns to include in the form" , I have no options to select from because I only have unique primary keys in my table.
Which Apex version is it? I've tried it on apex.oracle.com which uses 19.1 and it doesn't have that problem.
Anyway, two options I can think of:
temporarily drop primary key constraint
then create report + form pages
after you're done, create the primary key constraint once again
create an interactive report (using the wizard)
then create a form, manually adding items
this isn't as easy as it looks like because you'll have to create all processes as well (initialization one, along with automatic row processing)
I presume that the first option is a lot simpler.

How to enable auto increment primary key for Oracle database in PowerDesigner 16.6?

I am new to SAP PowerDesigner I am trying to created tables and link them together to get the DB model and I am having difficulties on enabling Auto increment for the primary Key column of tables. Can someone please guide me
I have looked online and there was mentioning of check marking something called as Identity. But I do not see that option on Column properties.Image2
Image1
Which version of Oracle are you using?
Oracle 12+ supports identity columns. In PowerDesigner, the Identityoption is available in the Oracle tab on the Column, when the DBMS for the Physical Data Model is ORACLE Version 12c.
create table CONTACTS (
ID int
generated always as identity ( start with 1 nocycle noorder) not null,
NAME varchar(100) not null,
constraint PK_CONTACTS primary key (ID)
);
For previous versions of Oracle, the autoincrement was implemented with sequence, and triggers. See this page of PowerDesigner online documentation for example.

Referential Integrity and Translations

Description
Hi, so I am looking at a legacy database that includes multiple translation tables for existing tables.
So there is a laws table, but then there is also a translation_laws table:
Laws (law_id, inForceDate, type, etc)
Translation_Laws (law_id, lang_code, translation)
There is also a law_type table:
Law_Type (law_type_id, description, isDecreed, etc.)
Translation_Law_Type(law_type_id, lang_code, translation)
So, with the following scheme referential integrity is maintained, but you end up with multiple translations tables.
I would prefer to make one table with the following format:
translations(table_name, id, lang_code, translation)`
This would basically be like bundle, key, lang_code, label. I could also combine bundle+key+lang_code into one varchar key: bundle.key.lang_code.
However, I don't see much of a way to define a relationship in Oracle SQL.
Questions:
Any Ideas how to define a relationship while using Integer IDs??
Would it be so bad to NOT to define a relationship in the database?
Only solution I can think of would be to try add a String foreign key to every table needing a translation (aaa.bbb.ccc.ddd) that is unique.
Update
Currently I have done away with the official relationships in the DB and made the following type of schema:
CREATE TABLE TRANSLATIONS(
DESCRIPTION_ENTITY VARCHAR(30) NOT NULL,
DESCRIPTION_COLUMN VARCHAR(30) NOT NULL,
KEY_OR_ID VARCHAR(30) NOT NULL,
LANG_CODE VARCHAR(2),
TEXT CLOB,
-- Legacy are To be able to cross check using columns - but not needed
LEGACY_TABLE VARCHAR(30) NOT NULL,
LEGACY_COLUMN VARCHAR(30) NOT NULL);
ALTER TABLE TRANSLATIONS
add CONSTRAINT UNIQUE_COMBINATION UNIQUE (DESCRIPTION_ENTITY, DESCRIPTION_COLUMN, KEY_OR_ID, LANG_CODE);
CREATE INDEX ind_description_entity ON TRANSLATIONS (DESCRIPTION_ENTITY);
CREATE INDEX ind_description_column ON TRANSLATIONS (DESCRIPTION_COLUMN);
CREATE INDEX ind_key_or_id ON TRANSLATIONS(KEY_OR_ID);
CREATE INDEX ind_lang_code ON TRANSLATIONS(LANG_CODE);
insert into TRANSLATIONS(DESCRIPTION_ENTITY, DESCRIPTION_COLUMN, KEY_OR_ID, LANG_CODE, TEXT, LEGACY_TABLE, LEGACY_COLUMN)
select 'LAW','TITLE', LAW_CODE, LANG_CODE, LAW_TITLE,
'LAW_TRANS','TITLE'
from LAW_TRANS where TITLE is not null;
Personally, I don't think there is anything wrong with not defining a relationship in a DB. At a massive investment bank where I was working before our Oracle specialists NEVER defined the relationships for performance reasons.
The basic question for your setup is, do you need a defined amount of languages or do you have to be flexible with adding languages later? If not, your approach is almost too flexible. Just adding different rows with the translation into the Laws table would be much more performant if you know you only every need 4 different languages.
Alternatively, you could just build a lock-up table:
original-string -> translated-string
And you can ignore the table name completely.

how to make oracle apex wizard steps with multiple related tables?

In Oracle Apex, I have some related tables i.e:
**Person Table**
Id
Name
**Person_Contact Table**
Id
PersonFK
Tel
Address
**Person_Account Table**
Id
PersonFK
BankName
AccountNumber
these are 1-to-1 tables and PersonFK is the Foreign Key.
Now, I want to create a wizard with 3 steps.
how can I do this?
should I define 3 tables with 1-to-1 relation (like above) or create just one big table?
and
what is the best practice in Oracle Apex (in wizard steps forms) for this purpose?
If you are sure that all three tables will remain have common attributes then the option of single table is fine. More detail can be find
here

Is there a table designer for VS2010 database project?

Am I missing something here? It seems that the only options to create a new table in a database project in VS2010 is:
Create a table object as a file, then create all constraints (defaults) as separate files, then create each index as a separate file, and primary key as a separate file and on and on...
Or
Create the entire table schema using the table designer in SSMS and then use the schema compare tool to create a single monolithic file of SQL statements for each element of the table and copy each block of code to a newly created file in VS.
This question was asked 2 years ago and I'm hoping the answer has changed.
Please tell me there's a hidden table designer for the database project in VS2010 that I have just overlooked.
I'm pretty sure there isn't one!
Can I ask why you need a table designer over creating and modifying creation script files for your new objects? Is there anything that this doesn't give you that a designer would?
I just noticed that VS 11 Beta now includes a designer, although it is rough around the edges (relationships, for example, still need to be typed by hand).
The way I use the database project in VS2010 is:
Create everything with SQL Server Management Studio.
Synchronize it into my database project.
When I need to change something, do it in SQL Server Management Studio.
Use Schema Comparisons to synchronize your database project.
Wow... can't believe no one has taken the time to answer this in all this time. Here's a sample of table creation script with some simple constraints.
CREATE TABLE [User]
(
UserID INT NOT NULL IDENTITY (1,1),
UserName NVARCHAR(20) NOT NULL,
UserPassword NVARCHAR(20) NOT NULL,
EmailAddress NVARCHAR(50) NOT NULL,
Location NVARCHAR(100),
MobileNumber VARCHAR(10),
CreatedDate DATETIME NOT NULL
CONSTRAINT User_CreatedDate_DF DEFAULT (GETDATE()),
CONSTRAINT User_UserID_PK PRIMARY KEY CLUSTERED (UserID),
CONSTRAINT User_UserName_UQ UNIQUE (UserName),
CONSTRAINT User_EmailAddress_CK CHECK (EmailAddress LIKE '%#%.%'),
CONSTRAINT User_MobileNumber_CK CHECK (MobileNumber LIKE '[2-9][0-9][0-9][2-9][0-9][0-9][0-9][0-9][0-9][0-9]')
)
You can use functions to embed in your check constraints, but again, this is a simplistic exaxmple.
As I commented here, the VS2010 reference states that there exist a Table Designer in this document.
But for some reason, no matter what kind of project I create (Server project 2008/2005, database project 2008/2005) I can't get the Table Designer being shown.

Resources