Linq to Entities: If I DON'T want a property called ID what is the attribute I need to use -


i creating poco object ado.net dataservce (they called wcf dataservices now) compiler tells me entities need have id property.

ok, that's fine don't want call mine id, want call 'code'. attribute put on property 'code' tell service 'primary key'?

i have been searching google answer today can't seem guess right sequence of words

you add attribute on poco class tells ado data services property unique key. example below. mark property use with: dataservicekey("id")]. in case "id". should able change somethign else.

 [dataservicekey("id")] public class phone {     public int id { get; set; }     public string number { get; set; }     public string extension { get; set; }     public string phonetype { get; set; }     public int sortoder { get; set; } } 

key property different name:

 [dataservicekey("code")] public class phone {     public int code { get; set; }     public string number { get; set; }     public string extension { get; set; }     public string phonetype { get; set; }     public int sortoder { get; set; } } 

Comments

Popular posts from this blog

c++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -