How to write a database "Save" method for a self-tracked class?
<p>In order to ask the question let me 
write a class which contain my question.</p>

<pre><code>class Student{

public int StudentId;
public string Name;
public int Age;
public string Address;


public void Save(){
   if (StudentId == 0){
   //// run the insert query here
/*
Insert into Student(Studentid,Name,Age,Address)values(...);
} else {
/// run the update query...
/*Update Student Set Address = @address , Age = @age , Name = @name
where StudentId = @stdid;*/
}
}
</code></pre>

<p>Now in order to use that class I will write the following code.</p>

<pre><code>Student Std = new Student{StudentId = 1, Name="xyz", Address = "Home"};

Std.Save(); //// this will insert the value in the database
</code></pre>

<p>Now later on.</p>

<pre><code>Student std1 = new Student();

std1.Studentid = 1;
std1.Age= 10;
std1.Save();
</code></pre>

<p>Now calling save this time will over write the Address with Null or empty string.</p>

<p>I seek advise on possible solutions to this problem.</p>

<p>There is a possibility that consumer wants to change the address with empty string.</p>

<p>Looking forward to replies.</p>

<p>Regards</p>

<p>K</p>

<p>}</p>
