新的WCF.
DataContact类可以从Interface继承吗?
例如:
[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; } }
解决方法
你可以这样做:
[DataContract(Namespace = ...........)] public class VesselSequence : IVesselSequence { [DataMember] public int AllocationId { get; set; } [DataMember] public string ScenarioName { get; set; } } interface IVesselSequence { int AllocationId { get; set; } string ScenarioName { get; set; } }
你不能这样做,可悲的是:
public class VesselSequence : IVesselSequence { public int AllocationId { get; set; } public string ScenarioName { get; set; } } [DataContract(Namespace = ...........)] interface IVesselSequence { [DataMember] int AllocationId { get; set; } [DataMember] string ScenarioName { get; set; } }