miniSql

创建
zgc123@gmail.com authored at 11/19/2023 1:40:15 AM
6136600
Tree
0 Parent(s)
Summary: 1 changed files with 38 additions and 0 deletions.
Added +38 -0
Added +38 -0
diff --git a/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt
new file mode 100644
index 0000000..35b3a84
--- /dev/null
+++ b/minisqlquery-master/src/MiniSqlQuery/Templates/Sample - WPF View Model.cs.mt
@@ -0,0 +1,38 @@
+## 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
\ No newline at end of file