Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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:

[BasicHttpBindingServiceMetadataExchangeEndpoint]
[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="http://schemas.microsoft.com/ado/2007/06/edmx">
  <edmx:DataServices xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" m:DataServiceVersion="1.0">
<Schema Namespace="XXX.Poco" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://schemas.microsoft.com/ado/2006/04/edm">
  <EntityType Name="Demarche">
    <Key>
      <PropertyRef Name="id" />
    </Key>
    <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" />
  </EntityType>

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
add comment

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.