I want to maintain a version number (e.g. 1.1, 1.3, 2.15, etc.) for my main entity. I can't use decimal to store the version as I have to store 1.1, that will get stored as 1.100 if I use decimal. Hence, I am planning to create a small version controller class which manipulate the version number and returns me major/minor/complete number as required, and want to map that with a varchar column in the database.
Example:
public class Item
{
public Guid Id {get;set;}
public string Name {get;set;}
**// I want to map this property with the varchar column in the database**
public Version Version {get;set;}
}
public class Version
{
public string FullVersion {get;set;}
public string Major {get;set;}
public string Minor {get;set;}
public void IncrementMinor()
{ // some logic }
public void IncrementMajor()
{ // some logic }
public override string ToString()
{
return FullVersion;
}
}
Any suggestion?