ADO.NET Data Services и LINQ to SQL: continuation

Recently I wrote about what actions are necessary, that the LINQ-to-SQL data model could work together with ADO.NET Data Services. I wish to add this information with one important fact.

Actually, there is an convention on which ADO.NET Data Services tries to define independently key fields in entity. This convention consists in the following – if the entity is not marked with DataServiceKey attribute, following actions are carried out:

  1. Among properties of entity property ID is searching. If it exists, it will be primary key;
  2. If property ID is not found, the propery “EntityTypeID” is searching. In this case “EntityType” means name of your entity. For example, if your entity is named as “Customer”, attempt to find out “CustomerID” will be made. If such property is found, it will be primary key;
  3. If these properties are not found, the error will be generated.

Many thanks to Phani Raj, for the information on the given behavior.

No Comments