views:

34

answers:

1

Hi!

I'm new to C# and Subsonic. I'm trying to solve the following case:

public class UnknownInt { 
  public int val;
  public bool known;
}

public class Record {
  public int ID;
  public UnknownInt data;
}

I'm using SimpleRepository. Is there a way I can get UnknownInt serialized before storing it in the SQL database (perhaps as XML text field?)

I'm trying to build a questionnaire system in which a user can provide an 'integer' answer, an 'Unknown' answer, as well as a Null answer (question not answered yet)

In other words - what interfaces does my UnknownInt class need to implement in order to be eligible and convertible into SubSonic 3.0 Simple Repository?

Cheers!

A: 

Try using a nullable int (int?) instead of you UnknownInt class - you can store it via subsonic. No XML conversion needed!

Saintedlama
It's unfortunately not what I am looking for (I use System.Nullable<int> a lot in other places and I'm aware of this)Basically, a 'null' value should represent a missing answer (i.e. answer for which statistical model should fail reporting what needs to be updated).An 'Unknown' answer is a valid answer (i.e. not null), the user has looked at the question and decided to leave it unanswered.I could encode it through some creative use of integer values outside of acceptable range (in essence, age -1 is 'unknown', age -2 is don't want to share etc), but this is not elegant.
qdot