Problem
I'm starting an application for Windows Phone 7.1, and I'm implementing the database, but I came across a situation that I did not find any similar situation to try to solve, and I also did not find anything to help me with the documentation. Microsoft.
The situation is as follows:
I have class
similar to this:
public class Setup : INotifyPropertyChanged, INotifyPropertyChanging
{
private long _id;
private string _descricao;
private IList<long> _tempos;
[Column(IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false, AutoSync = AutoSync.OnInsert)]
public virtual long Id
{
get { return _id; }
set
{
if (value != _id)
{
_id = value;
NotifyPropertyChanged("Id");
}
}
}
[Column]
public virtual string Descricao
{
get { return _descricao; }
set
{
if (value != _descricao)
{
_descricao = value;
NotifyPropertyChanged("Nome");
}
}
}
// como eu faria para mapear corretamente esse campo
[Column]
public virtual IList<long> Tempos
{
get
{
if (_tempos == null)
_tempos = new List<long>();
return _tempos;
}
set
{
if (value != _tempos)
{
NotifyPropertyChanging("");
_tempos = value;
NotifyPropertyChanged("Tempos");
}
}
}
// Version column aids update performance.
[Column(IsVersion = true)]
private Binary _version;
public event PropertyChangedEventHandler PropertyChanged;
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
public event PropertyChangingEventHandler PropertyChanging;
private void NotifyPropertyChanging(string propertyName)
{
if (PropertyChanging != null)
{
PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
}
}
}
Question
In the case, how would I correctly map the IList<long> Tempos
, since it is not a simple field, it is a list of long
, or would have to create a class
(Time, for example) and treat as a 1 x N relationship? If this is how it would be? If possible with examples.