Last post Sep 05, 2010 04:30 PM by gerhardm
Sep 02, 2010 04:28 PM|gerhardm|LINK
I am working on a 'Asp.Net Dynamic Data Domain Service Web Application' project using just 2 tables, FAQ_Categories and FAQs. The FAQs table has a foreign key to the FAQ_Categories.
The steps are straight forward.
Add a new project (Asp.Net Dynamic Data Domain Service Web Applications)
Add folders Model ( for Linq2Sql datacontext), Domain (for the Domain Services class)
Add Linq2Slql and add the 2 tables to the designer.
Build the project.
Add the Domain Service Class to the Domain folder.
in the wizard select the DataContext, uncheck the Enable Client & Expose ODate checkbox
Check bothe table & their corresponding Enable Editing tables checbox
Check the Generate Metadata class
In Global.asax set Scaffold to true and add the DomainService name.
Build and run.
Pages List and Detail are working fine.
But if I try to insert a new record, I get the error "FaqId is required"
Faq_ID is the primary key in the database table and it is set to Identiy.
The Datacontext is correct, it marked the FAQ table with
<Global.System.Data.Linq.Mapping.ColumnAttribute(Storage:="_CustomerId", AutoSync:=AutoSync.OnInsert, DbType:="Int NOT NULL IDENTITY", IsPrimaryKey:=true, IsDbGenerated:=true)> _
I tried this using Linq2Sql, Entity Framework, And both in VB and C# with the same result.
I am using VS2010 Ultimate, .NET 4.0, SQL Express 2008, Windows 7 32bit Ultimate.
Did I miss anything here?
Any help would be appreciated.
Thanks in advance for any help.
VS2010 & .Net 4.0
Dynamicic Data 4.0
Asp.net 4.0 Web Application
Sep 05, 2010 02:21 AM|davidebb|LINK
Please take a look at this thread, which I think discusses the same issue. Well, it discusses two distinct issues and this is one of them. In short, the solution is to add a ScaffoldColumn(false) attribute on your
ID property in the metadata class (the one generated when you created the web service).
Hope this helps,
Sep 05, 2010 04:30 PM|gerhardm|LINK
Adding the ScaffoldColumn(false) attribute to the ID field did the trick!
Thank you very much for your help.