OK, this is the problem that I'm trying to solve - I want to assign object properities returned through linq from db, to this object prperties and get possibility to update any changes, without inserting new row in db.
partial class Employee : Person
{
public Employee(int id = 0)
{
if (id > 0)
this.get(id);
}
public override bool get(int id)
{
Employee empl = db.Employees.Single(Employee => Employee.id == id);
if (empl != null)
{
// here I need to do sth like
this = empl;
// or
ObjectProperties.Copy(empl, this);
return true;
}
else
return false;
}
public override void save()
{
if (this.id > 0)
{
db.SubmitChanges();
}
else
{
db.Employees.InsertOnSubmit(this);
db.SubmitChanges();
}
}
public override void remove()
{
if (this.id > 0)
{
db.Employees.DeleteOnSubmit(this);
db.SubmitChanges();
}
}
}
And I don't want to make get method static.