Change LINQ2SQL property in partial class?
- by Fermin
Hi,
I have a table in my LINQ2SQL diagram with a column called DayOfWeek in table JourneyBooking. The designer.cs has the definition of this as:
[Column(Storage="_DayOfWeek", DbType="TinyInt NOT NULL")]
public int DayOfWeek
{
get
{
return this._DayOfWeek;
}
set
{
if ((this._DayOfWeek != value))
{
this.OnDayOfWeekChanging(value);
this.SendPropertyChanging();
this._DayOfWeek = value;
this.SendPropertyChanged("DayOfWeek");
this.OnDayOfWeekChanged();
}
}
}
I have a partial class for the JourneyBooking class. Is it possible to extend/overwrite the above DayOfWeek property with my own property?
The issue I am having is that DayOfWeek is 0-6 in C# but 1-7 in SQL, so I was thinking that I could overwrite the DayOfWeek property to subtract or add 1 depending on whether it was a get or set, is this possible or would I need to re-write all of the above code in my partial class?