tags:

views:

2308

answers:

2

New to WCF.

Can DataContact class inherit from Interface ?

eg:

[DataContract(Namespace = ...........)]
public class VesselSequence : IVesselSequence
{

    [DataMember]
    public int AllocationId { get; set; }

    [DataMember]
    public string ScenarioName { get; set; }
}

interface VesselSequence : IVesselSequence
{
    public int AllocationId { get; set; }
    public string ScenarioName { get; set; }
}
A: 

sure it can, but keep in mind if you are returning the interface type you have to define the KnownTypes attribute for the serializer.

Martin Moser
Hi Martin.. is there any good examples on web somewhere ?
Nev_Rahd
+2  A: 

You can check this and this, for dealing with interfaces inside WCF

Ahmed Said