SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm dealing with an issue with a SharePoint 2010 Hosted WCF Data Services. So Keep in mind that i'm restricted to work with .NET 3.5. In order to generate the CSDL endpoint for descripting my entities, I use the appropriate decorator and I enjoy the benefits of reflexion to handle this job for me.

Here is the code for the MEX point:

[ServiceBehavior(IncludeExceptionDetailInFaults = true)]
public class Demarches : DataService<CacheDataContext>
    public static void InitializeService(DataServiceConfiguration config)
        config.UseVerboseErrors = true;
        config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
        config.SetServiceOperationAccessRule("*", ServiceOperationRights.AllRead);
        config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V2;

Here is a part of the CSDL file I get with the code above:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <edmx:Edmx Version="1.0" xmlns:edmx="">
  <edmx:DataServices xmlns:m="" m:DataServiceVersion="1.0">
<Schema Namespace="XXX.Poco" xmlns:d="" xmlns:m="" xmlns="">
  <EntityType Name="Demarche">
      <PropertyRef Name="id" />
    <Property Name="id" Type="Edm.Int32" Nullable="false" />
    <Property Name="titre" Type="Edm.String" Nullable="true" />
    <Property Name="avancement" Type="Edm.String" Nullable="true" />
    <Property Name="date" Type="Edm.DateTime" Nullable="false" />
    <NavigationProperty Name="historiques" Relationship="XXX.Poco.Demarche_historiques" FromRole="Demarche" ToRole="historiques" />
    <NavigationProperty Name="proprietes" Relationship="XXX.Poco.Demarche_proprietes" FromRole="Demarche" ToRole="proprietes" />
    <Property Name="CacheDurationInSeconds" Type="Edm.Int32" Nullable="false" />
    <Property Name="CacheDurationInMinutes" Type="Edm.Int32" Nullable="false" />
    <Property Name="CacheDurationInHours" Type="Edm.Int32" Nullable="false" />

I have to put a flag on the "avancement" property because it's an enum in my business code and I would like to know dynamically, when I read the CSDL endpoint, what property are enum in order to provide a dynamic filtering system when I develop client apps. I should have something like that <Property Name="avancement" Type="Edm.String" Nullable="true" isFilterable="true"/> for instance.

First of all, do you know whether or not that kind of modifications can break some tools parsing like SvcUtil.exe, Jaydata.exe ? So, is it possible achieve this goal programmatically when I initialize the Web Service Configuration for instance ?

Thanks for suggestions, and I apologize if my english is not proper.

share|improve this question

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.