1、下载并安装动软代码生成器;
2、下载vJine.Core.Orm模板;
3、解压模本文件并复制到如下的动软代码生成器模板目录;
4、打开动软代码生成器会看到模板已识别加载;
5、选择模板代码批量生成;
6、在弹出的对话框中依据需要选择,此例选择上一篇博文中生成的My_Model表;
7、生成成功后产生如下代码,如果您阅读前篇博文,通过对比会发现属性"MyStatus"为整形而非枚举类型,这一点需要特别注意。
using System;
using System.Xml.Serialization; using vJine.Core.Base;
using vJine.Core.IO;
using vJine.Core.ORM; namespace vJine.Modules.LOT.BML
{
[Serializable]
public partial class My_Model : ItemBase
{ public partial class _
{
public static readonly Property<My_Model, string> ID = new Property<My_Model, string>("ID");
}
private string _ID;
[XmlAttribute("ID")]
[Map(IsPrimary=true)]
public string ID
{
get
{
return this._ID;
}
set
{
if (this._ID != value)
{
this._ID = value;
this.NotifyPropertyChanged("ID");
}
}
} public partial class _
{
public static readonly Property<My_Model, bool> IsActive = new Property<My_Model, bool>("IsActive");
}
private bool _IsActive;
[XmlAttribute("IsActive")]
public bool IsActive
{
get
{
return this._IsActive;
}
set
{
if (this._IsActive != value)
{
this._IsActive = value;
this.NotifyPropertyChanged("IsActive");
}
}
} public partial class _
{
public static readonly Property<My_Model, int> MyStatus = new Property<My_Model, int>("MyStatus");
}
private int _MyStatus;
[XmlAttribute("MyStatus")]
public int MyStatus
{
get
{
return this._MyStatus;
}
set
{
if (this._MyStatus != value)
{
this._MyStatus = value;
this.NotifyPropertyChanged("MyStatus");
}
}
} public partial class _
{
public static readonly Property<My_Model, int> Qty = new Property<My_Model, int>("Qty");
}
private int _Qty;
[XmlAttribute("Qty")]
public int Qty
{
get
{
return this._Qty;
}
set
{
if (this._Qty != value)
{
this._Qty = value;
this.NotifyPropertyChanged("Qty");
}
}
} public partial class _
{
public static readonly Property<My_Model, DateTime> Stamp = new Property<My_Model, DateTime>("Stamp");
}
private DateTime _Stamp;
[XmlAttribute("Stamp")]
public DateTime Stamp
{
get
{
return this._Stamp;
}
set
{
if (this._Stamp != value)
{
this._Stamp = value;
this.NotifyPropertyChanged("Stamp");
}
}
}
}
}