I have a entity class Usuario and I want to create a partial class to add some methods in Usuario. I did:
public partial class Usuario
{
public static List<string> CarregarPreferencias(){
// Do it!
return null;
}
}
When I call Usuario in Context “Ctx.Usuario.CarregarPreferencias()” it appears, but when I create a instance of Usuario it not:
Usuario user = new Usuario();
user.CarregarPrefer..... // <<< my method don't appears
What I’m missing?
A static method doesn’t appear on instances of the class. Remove static from the method declaration if you want to call the method against instances of the class.