LLBLGen not generating Fetch methods for Unique Constraints

Posts   
 
    
apb
User
Posts: 41
Joined: 21-Oct-2008
# Posted on: 10-Mar-2009 18:54:03   

Hi,

I'm using 2.6, self-service. Usually when a table has unique constraint, I get a fetch method for it. The following table, however, is not getting a method for the [username] field. Any ideas?

CREATE TABLE [dbo].[usernames]( [username_id] [int] IDENTITY(0,1) NOT NULL, [username] nvarchar NOT NULL, PRIMARY KEY CLUSTERED ([username_id] ASC))

CREATE UNIQUE NONCLUSTERED INDEX [IDX_usernames_username] ON [dbo].[usernames] ( [username] ASC )

Thanks.

-Al

MTrinder
User
Posts: 1461
Joined: 08-Oct-2008
# Posted on: 10-Mar-2009 22:49:32   

Catches me every time simple_smile You need to create it as a unique constraint rather than a unique index.


CREATE TABLE [dbo].[usernames](
    [username_id] [int] IDENTITY(0,1) NOT NULL,
    [username] [nvarchar](256) NOT NULL,
PRIMARY KEY CLUSTERED 
(
    [username_id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY],
 CONSTRAINT [IDX_usernames_username] UNIQUE NONCLUSTERED 
(
    [username] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

or in the index designer dialog in management studio change the index type from "index" to "Unique Key"

Matt

apb
User
Posts: 41
Joined: 21-Oct-2008
# Posted on: 10-Mar-2009 23:03:38   

Thanks! Totally missed that minor detail. smile

-Al