<#@ template language="c#v3.5" debug="True" hostspecific="True" #> <#@ output extension=".generated.cs" #> <#@ assembly name="System.Core" #> <#@ assembly name="C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll" #> <#@ assembly name="System.Xml" #> <#@ assembly name="System.Xml.Linq" #> <#@ import namespace="System.Xml.Linq" #> <# var templateDir = new System.IO.FileInfo(Host.TemplateFile).Directory; var nameSpace = templateDir.Parent.Name+"."+templateDir.Name; var edmxFile = templateDir.Parent.FullName+@"\Service References\"+templateDir.Name+@"\service.edmx"; XDocument doc = XDocument.Load(edmxFile); XNamespace edm = "http://schemas.microsoft.com/ado/2006/04/edm"; #> using System.ComponentModel; // // Changes to this file may cause incorrect behavior and will be lost if the code is regenerated. // namespace <#=nameSpace#> { <#foreach(XElement entity in doc.Descendants(edm+"EntityType")){ #> partial class <#=entity.Attribute("Name").Value#>:INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void firePropertyChanged(string propertyName) { var e = PropertyChanged; if (e != null){e(this, new PropertyChangedEventArgs(propertyName));} } <#foreach(XElement property in entity.Descendants(edm+"Property")) { var name = property.Attribute("Name").Value; #> partial void On<#=name#>Changed() { firePropertyChanged("<#=name#>"); } <#}#> } <#}#> }