S
shapper
Hello,
I have the following class:
public class TagHelper {
private MyAppDataContext database = new MyAppDataContext();
public static bool Find(string name) {
bool found = database.Tags.Where(t => t.Name ==
this.Tag.Name).Any();
return !found;
}
}
I get the following error:
An object reference is required for the non-static field, method, or
property
On code line:
bool found = database.Tags.Where(t => t.Name == this.Tag.Name).Any();
I tried to change to the database instance to public:
private MyAppDataContext database = new MyAppDataContext();
But the problem happens.
What am I doing wrong?
Thank You,
Miguel
I have the following class:
public class TagHelper {
private MyAppDataContext database = new MyAppDataContext();
public static bool Find(string name) {
bool found = database.Tags.Where(t => t.Name ==
this.Tag.Name).Any();
return !found;
}
}
I get the following error:
An object reference is required for the non-static field, method, or
property
On code line:
bool found = database.Tags.Where(t => t.Name == this.Tag.Name).Any();
I tried to change to the database instance to public:
private MyAppDataContext database = new MyAppDataContext();
But the problem happens.
What am I doing wrong?
Thank You,
Miguel