/// <summary> /// 属性事件处理 /// </summary> /// <param name="property"></param> protected override void OnPropertyChangedInner(string property) { switch (property) { case nameof(TargetConfig.Name): TargetConfig.RaisePropertyChanged(nameof(TargetConfig.DisplayName)); break; case nameof(TargetConfig.SaveTableName): TargetConfig.RaisePropertyChanged(nameof(TargetConfig.ReadTableName)); TargetConfig.RaisePropertyChanged(nameof(TargetConfig.DisplayName)); TargetConfig.RaisePropertyChanged(nameof(TargetConfig.SaveTable)); break; case nameof(TargetConfig.ReadTableName): TargetConfig.RaisePropertyChanged(nameof(TargetConfig.SaveTableName)); TargetConfig.RaisePropertyChanged(nameof(TargetConfig.DisplayName)); TargetConfig.RaisePropertyChanged(nameof(TargetConfig.SaveTable)); break; case nameof(TargetConfig.Classify): OnClassifyChanged(); break; case nameof(TargetConfig.Project): CheckEntityProject(); break; } }
/// <summary> /// 属性事件处理 /// </summary> /// <param name="property"></param> protected override void OnPropertyChangedInner(string property) { if (TargetConfig?.Parent == null) { return; } switch (property) { case nameof(TargetConfig.Name): case nameof(TargetConfig.ColumnName): SyncLinkField(field => field.LinkField = TargetConfig.ColumnName); break; case nameof(TargetConfig.CanEmpty): if (!TargetConfig.CanEmpty) { TargetConfig.IsRequired = true; } break; case nameof(TargetConfig.Nullable): TargetConfig.RaisePropertyChanged(nameof(TargetConfig.DbNullable)); break; } }
/// <summary> /// 发出属性修改前事件 /// </summary> /// <param name="property">属性</param> /// <param name="oldValue">旧值</param> /// <param name="newValue">新值</param> protected override void BeforePropertyChangedInner(string property, object oldValue, object newValue) { switch (property) { case nameof(TargetConfig.Key): GlobalConfig.ConfigDictionary.Remove((Guid)oldValue); break; case nameof(TargetConfig.Name): var now = (string)newValue; if (!string.IsNullOrWhiteSpace(now) && !TargetConfig.OldNames.Contains(now) && now != "NewField") { TargetConfig.OldNames.Add(now); } TargetConfig.RaisePropertyChanged(nameof(TargetConfig.NameHistory)); break; } }
/// <summary> /// 发出属性修改前事件 /// </summary> /// <param name="property">属性</param> /// <param name="oldValue">旧值</param> /// <param name="newValue">新值</param> protected override void BeforePropertyChanged(string property, object oldValue, object newValue) { if (TargetConfig.IsPredefined) { return; } switch (property) { case nameof(TargetConfig.Name): var now = (string)newValue; if (!string.IsNullOrWhiteSpace(now) && !TargetConfig.OldNames.Contains(now) && now != "NewField") { TargetConfig.OldNames.Add(now); } TargetConfig.RaisePropertyChanged(nameof(TargetConfig.NameHistory)); break; } BeforePropertyChangedInner(property, oldValue, newValue); }