WCF Data Service gibt 404 an, wenn OData-Anforderungen für abgeleitete Typen gestellt werden

Ich glaube, mir fehlt ein Trick, um WCF-Datendienste / OData / Inheritance zum Laufen zu bringen. Ich habe ein paar einfache Tabellen erstellt:

create table Super 
(
superID int IDENTITY(1,1) not null PRIMARY KEY, 
supername nvarchar(55),
)


create table sub
(
superID int not null,
extraData nvarchar(100),
FOREIGN KEY (superID) REFERENCES Super(superID)
)


insert Super values('abc')
insert Super values('def')
insert Super values('ghi')
insert Super values('jkl')
insert Super values('mno')


insert sub values(1, 'pqrstu')
insert sub values(3, 'vwxyz')

Zog sie in eine EDMX-Datei und ersetzte die automatisch erstellte Beziehung durch eine Vererbungsbeziehung, die Folgendes generiert:

namespace WebApplication3
{
#region Contexts

public partial class Entities : ObjectContext
    {        ....    }

#endregion

#region Entities

[EdmEntityTypeAttribute(NamespaceName="Model", Name="sub")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
public partial class sub : Super
    {
    #region Factory Method
    ...
    #endregion
    #region Primitive Properties

    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
    [DataMemberAttribute()]
    public global::System.String extraData
    ...

    #endregion

    }


[EdmEntityTypeAttribute(NamespaceName="Model", Name="Super")]
[Serializable()]
[DataContractAttribute(IsReference=true)]
[KnownTypeAttribute(typeof(sub))]
public partial class Super : EntityObject
    {
    #region Factory Method
    ...

    #endregion
    #region Primitive Properties


    [EdmScalarPropertyAttribute(EntityKeyProperty=true, IsNullable=false)]
    [DataMemberAttribute()]
    public global::System.Int32 superID
    ...


    [EdmScalarPropertyAttribute(EntityKeyProperty=false, IsNullable=true)]
    [DataMemberAttribute()]
    public global::System.String supername
    ...

    #endregion

    }

#endregion

}

Richten Sie den Service für die Verwendung von V3 ein:

namespace WebApplication3
    {
    public class WcfDs : DataService<Entities>
        {
        public static void InitializeService(DataServiceConfiguration config)
            {
            config.SetEntitySetAccessRule("*", EntitySetRights.AllRead);
            config.DataServiceBehavior.MaxProtocolVersion = DataServiceProtocolVersion.V3;
            }
        }
    }

Das Abfragen der Supers funktioniert einwandfrei:

http://localhost:8384/WcfDs.svc/Supers

Ich habe vergeblich versucht, eine Vielzahl von URLs abzurufen, um die abgeleiteten Typen zu ermitteln:

http://localhost:8384/WcfDs.svc/Supers/Model.sub/
http://localhost:8384/WcfDs.svc/Supers(1)/Model.sub/
http://localhost:8384/WcfDs.svc/Supers/WebApplication3.sub/
http://localhost:8384/WcfDs.svc/Supers(1)/WebApplication3.sub/
....

aber ich bekomme immer eine 404 Ressource Antwort nicht gefunden. Was vermisse ich?

Antworten auf die Frage(1)

Ihre Antwort auf die Frage