#眉標=Software Product Line Engineering #副標=軟體產品線工程在微軟開發平台的實踐(4) #大標= Domain-Specific Language Tools進階應用 #作者=文/圖 歐宣修 #引言= ==程式1 =========== namespace Dands.DLF1 { /// /// DomainClass Field /// Description for Dands.DLF1.Field /// 略… public partial class Field : DslModeling:: ModelElement { 略… } } ================ ==程式2 =========== namespace Dands.DLF1 { using System; using System.Collections.Generic; using System.Text; using System.Collections.Specialized; using Microsoft.VisualStudio.Modeling.Validation; [ValidationState(ValidationState.Enabled)] //…………(1) public partial class Field { [ValidationMethod ( ValidationCategories.Save | ValidationCategories.Menu ) ] //…………(2) private void ValidateFromTo( ValidationContext context) { if (this.From > this.To) { //…………(3) context.LogError("From must be less than or equals than To", "FromToError", this); } } } } ================