Object Model Contracts
I'm trying to create a data model for WCF based off of interfaces from my core object model, but I'm having trouble with some of the associations
Currently I have this in my core data model
public class A : IA {
public string name { /* ... */ }
public EntitySet<B> children { /* ... */ }
}
public class B : IB {
public string name { /* ... */ }
}
However when I define the interface IA I get compiler errors saying A doesn't implement all of IA. Here is the interface
public interface IA<BType> where BType: IB {
string name {get; set;}
开发者_StackOverflow社区 IEnumerable<Btype> children {get;}
}
Why can't an instance of A be passed as an IA reference, given these class and interface definitions?
Compilation error because public EntitySet<B> children
is not implementation of IEnumerable<Btype> children {get;}
(.net <4.0 version does not support covariance\contravariance)
精彩评论