Windows Phone Mango 本地数据库数据访问层
2011-11-15 10:30
351 查看
Domain文件夹
User类
public class User : INotifyPropertyChanged, INotifyPropertyChanging
{
private int _index;
[Column(IsPrimaryKey = true, CanBeNull = false, IsDbGenerated = true, DbType = "INT NOT NULL Identity", AutoSync = AutoSync.OnInsert)]
public int Index
{
get
{
return _index;
}
set
{
if (_index != value)
{
NotifyPropertyChanging("Index");
_index = value;
NotifyPropertyChanged("Index");
}
}
}
private string _name;
[Column]
public string Name
{
get
{
return _name;
}
set
{
NotifyPropertyChanging("Name");
_name = value;
NotifyPropertyChanged("Name");
}
}
private String _gen;
[Column]
public String Gen
{
get
{
return _gen;
}
set
{
NotifyPropertyChanging("Gen");
_gen = value;
NotifyPropertyChanged("Gen");
}
}
private int _age;
[Column]
public int Age
{
get
{
return _age;
}
set
{
NotifyPropertyChanging("Age");
_age = value;
NotifyPropertyChanged("Age");
}
}
//private BitmapImage _thumbnail;
//[Column]
//public BitmapImage Thumbnail
//{
// get
// {
// return _thumbnail;
// }
// set
// {
// NotifyPropertyChanging("Thumbnail");
// _thumbnail = value;
// NotifyPropertyChanged("Thumbnail");
// }
//}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
// Used to notify the page that a data context property changed
private void NotifyPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
#region INotifyPropertyChanging Members
public event PropertyChangingEventHandler PropertyChanging;
// Used to notify the data context that a data context property is about to change
private void NotifyPropertyChanging(string propertyName)
{
if (PropertyChanging != null)
{
PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
}
}
#endregion
}
User类