miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
732.00 B
Sample - WPF View Model.cs.mt
## Example WPF "View Model" template
## Assumes the use of something like http://mvvmfoundation.codeplex.com/ for the base classes etc

## NOTE - "WIP"

#foreach ($table in $Host.Model.Tables)
#set($classNm = ${Host.ToPascalCase($table.Name)} )
public class ${classNm}ViewModel : ObservableObject
{
	private ${classNm}Entity _entity;
	
	public ${classNm}ViewModel(${classNm}Entity entity)
	{
		_entity = entity;
	}
#foreach ($c in $table.Columns)
#set($nm=$Host.ToPascalCase($c.Name))

	public $c.DbType.SystemType.Name ${nm}
	{
		get { return _entity.${nm}; }
		set
		{
			if (_entity.${nm} != value)
			{
				_entity.${nm} = value;
				OnPropertyChanged("${nm}");
			}
		}
	}
#end

	//TODO - sample commands, save etc
}



#end