I don't understand what's happening here, I've copied this code from another project (which compiled without problems), but as soon as I got it into my own, I got a compiler error on the constructor definition saying the method needs a return type.
public abstract class BaseSqlRepository<T, InterfaceT, PrimaryKeyT>
where T : class
where InterfaceT : class
{
protected EvalgridEntities DataContext;
protected BaseSqlRespository(EvalgridEntities db)
{
this.DataContext = db;
}
}
Method must have a return type.
What am I missing?
You misspelled it. Your constructor is spelled BaseSqlRe sp ository.
Change to:
protected BaseSqlRepository(EvalgridEntities db)
{
this.DataContext = db;
}
Since the naming is different, the compiler sees this as a method, not a constructor. Since there is no return type, you get the error:
Method must have a return type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With