I have a class that is generated by a third party tool:
public partial class CloudDataContext : DbContext
{
// ...SNIPPED...
public DbSet<User> Users { get; set; }
}
I create a partial class and then assign an interface so that I can inject this class later:
public partial class CloudDataContext : IDataContext
{
}
The IDataContext
has the single property Users
.
This won't compile, the compiler complains that the interface isn't implemented.
If I move the interface to the generated class, it works fine. I can't do that though as it's generated code.
How can I apply an interface to a partial class to expose the class as defined above?
IDataContext
and the implementation ofCloudDataContext
? I just ran this example and it works just fine. – Signalmanusing
directives at the top of the two class files different? Is it possible that in the one code file,IDataContext
resolves to one interface, and in the other code fileIDataContext
resolves to a second different interface? – Bisulfate