Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Need Help With Custom Profile Providers

Reply
Thread Tools

Need Help With Custom Profile Providers

 
 
pbd22
Guest
Posts: n/a
 
      12-30-2008

Hi.

I am trying to roll my own profile provider and have some questions
just so I make sure
I understand what I am doing. I have followed the example on MSDN
here:

http://msdn.microsoft.com/en-us/libr...7y(VS.85).aspx

Prior to reading about custom profiles, I had my own "Users" table in
my database and
wasn't sure what to do with this table after reading through the
Custom Profile Provider
example. I guessed that the table in the example, ProfileData, was
meant to store
the same kind of data I previously stored in my Users table so I moved
all the columns
from Users into ProfileData (Illustrated below in 'ProfileData').

What I am unclear on is what is the point of of separating the
Profiles table (below) from the
ProfileData table per the MSDN example? I understand that Profiles
serves as the PK table to which all related entities can map but what
is so unique about its column fields that they cannot also be put in
the ProfileData table?

The way I am currently looking at it:

1) When the user registers, a new record is created int he Profile
table and his registration information is stored in the ProfileData
table.

2) When the user logs in, credentials are checked in ProfileData and
then further information
is stored as a session in Web.config (shown below - is this right?)
for fast access.

I feel like I am missing some of the basics here (am I?) and
appreciate any help along those lines. Thanks in advance.

TABLES:

USE [DBDev]
GO
/****** Object: Table [dbo].[Profiles] Script Date: 12/30/2008
16:42:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING OFF
GO
CREATE TABLE [dbo].[Profiles](
[profileid] [int] IDENTITY(1,1) NOT NULL,
[username] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[applicationname] [varchar](50) COLLATE Latin1_General_CI_AI NOT
NULL,
[isanonymous] [bit] NULL,
[lastactivitydate] [datetime] NULL,
[lastupdateddate] [datetime] NULL,
PRIMARY KEY CLUSTERED
(
[profileid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [PKProfiles] UNIQUE NONCLUSTERED
(
[username] ASC,
[applicationname] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF

------------------------------------------------------------------------------------------------------------------------------------

USE [DBDev]
GO
/****** Object: Table [dbo].[ProfileData] Script Date: 12/30/2008
16:43:15 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING OFF
GO
CREATE TABLE [dbo].[ProfileData](
[profileid] [int] NOT NULL,
[lastname] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[firstname] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[email] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[alternateemail] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[password] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[securityquestion] [varchar](50) COLLATE Latin1_General_CI_AI NOT
NULL,
[securityanswer] [varchar](50) COLLATE Latin1_General_CI_AI NOT NULL,
[zipcode] [int] NOT NULL,
[birthmonth] [tinyint] NOT NULL,
[birthday] [tinyint] NOT NULL,
[birthyear] [int] NOT NULL,
[gender] [varchar](10) COLLATE Latin1_General_CI_AI NULL,
[city] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[state] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[country] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[registerdate] [datetime] NOT NULL,
[editdate] [datetime] NULL,
[confirmed] [bit] NULL CONSTRAINT
[DF__ProfileData__confirmed__4CC05EF3] DEFAULT ((0)),
CONSTRAINT [PK_ProfileData] PRIMARY KEY CLUSTERED
(
[profileid] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY],
CONSTRAINT [IX_email] UNIQUE NONCLUSTERED
(
[email] ASC
)WITH (IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF
GO
USE [TrezoroDBDev]
GO
ALTER TABLE [dbo].[ProfileData] WITH CHECK ADD CONSTRAINT
[FKProfiles2] FOREIGN KEY([profileid])
REFERENCES [dbo].[Profiles] ([profileid])

-----------------------------------------------------------------------------------------------------------------------------------------

WEB.CONFIG:

<profile defaultProvider="DBDev">
<providers>
<clear />
<add
name="DBDev"
type="ProfileProvider.Provider.ProfileProvider"
connectionStringName="cDB"
applicationName="MyApplication"
/>
</providers>
<properties>
<add name="lastname"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="firstname"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="email"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="securityquestion"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="securityanswer"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="zipcode"
type="int"
defaultValue="[null]"
allowAnonymous="true" />
<add name="birthmonth"
type="int"
defaultValue="[null]"
allowAnonymous="true" />
<add name="birthday"
type="int"
defaultValue="[null]"
allowAnonymous="true" />
<add name="birthyear"
type="int"
defaultValue="[null]"
allowAnonymous="true" />
<add name="gender"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="city"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="state"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="country"
type="string"
defaultValue="[null]"
allowAnonymous="true" />
<add name="registerdate"
type="datetime"
defaultValue="[null]"
allowAnonymous="true" />
</properties>
</profile>
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Unit tests available for Membership, Role, and Profile providers? Roger Martin ASP .Net 0 05-28-2008 09:22 PM
multiple profile providers in single web application Mike ASP .Net 1 06-27-2007 08:23 PM
Profile Providers Fernando Chilvarguer ASP .Net 0 02-09-2007 10:32 PM
Help - custom providers and instances Tullamore ASP .Net 0 10-31-2006 08:00 AM
newbie: problems with Profile.Providers Jeff ASP .Net 1 07-04-2006 06:05 PM



Advertisments