Home > English > Modifying a column with the Identity pattern is not supported.

Modifying a column with the Identity pattern is not supported.

In doing some testing today, I came across a wierd scenario with using WCF RIA Services on top of the Entity Framework. I was testing a Site table that had the following data definition:

CREATE TABLE Site
(
	  SiteIdent int identity NOT NULL
	, SiteKey varchar(4) primary key NOT NULL
	, MinimumPasswordLength int NOT NULL
	, RequirePasswordAuthentication bit NOT NULL
)

When I tried to make a modification to an existing record, I received the message in the title of my post:

“Modifying a column with the Identity pattern is not supported.”

One thing to note, I saw several other posts stating that this works with Entity Framework outside of WCF RIA Services. I verified that the StoreGeneratedPattern was set to “Identity” but it did not help. I also saw an entry in the msdn forums talking about creating a custom attribute.

Because I have control of the database, I made the following change to the data model to correct the issue:

CREATE TABLE Site
(
	  SiteIdent int identity primary key NOT NULL
	, SiteKey varchar(4) NOT NULL
	, MinimumPasswordLength int NOT NULL
	, RequirePasswordAuthentication bit NOT NULL
) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [IX_Site0] ON [dbo].[Site]
(
	[SiteKey] ASC
) ON [PRIMARY]

It is curious since I did not encounter this problem when I had previously used RIA Services on top of Linq2Sql. I am sure that there are several ways to resolve this issue but I wanted to show one way to getting past this issue.

Hope this helps….

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: