public PropertyInfo AddProperty(IColumInfoModel info) { var propertyName = info.GetPropertyName(); var targetType = info.ColumnInfo.TargetType; if (info.ColumnInfo.Nullable && !info.ColumnInfo.TargetType.IsClass) { targetType = typeof(Nullable <>).MakeGenericType(targetType); } var codeMemberProperty = AddProperty(propertyName, info.ColumnInfo.ColumnName, targetType); if (info.IsRowVersion) { codeMemberProperty.Attributes.Add(new AttributeInfo() { Name = nameof(RowVersionAttribute) }); } if (!string.IsNullOrEmpty(info.NewColumnName)) { codeMemberProperty.Attributes.Add(new AttributeInfo() { Name = nameof(ForModelAttribute), ConstructorSetters = { { "alternatingName", "\"" + info.ColumnInfo.ColumnName + "\"" } } }); } return(codeMemberProperty); }
public CodeMemberProperty AddProperty(IColumInfoModel info) { var propertyName = info.GetPropertyName(); var targetType = info.ColumnInfo.TargetType.FullName; CodeMemberProperty codeMemberProperty; if (info.EnumDeclaration != null) { codeMemberProperty = AddProperty(propertyName, new CodeTypeReference(info.EnumDeclaration.Name)); //var enumConverter = new ValueConverterAttribute(typeof(EnumMemberConverter)); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(ValueConverterAttribute).Name, new CodeAttributeArgument(new CodeTypeOfExpression(typeof(EnumMemberConverter))))); } else { codeMemberProperty = AddProperty(propertyName, new CodeTypeReference(targetType)); if (info.IsRowVersion) { var forModel = new RowVersionAttribute(); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(forModel.GetType().Name)); } } if (!string.IsNullOrEmpty(info.NewColumnName)) { var forModel = new ForModelAttribute(info.ColumnInfo.ColumnName); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(forModel.GetType().Name, new CodeAttributeArgument(new CodePrimitiveExpression(forModel.AlternatingName)))); } return codeMemberProperty; }
public ColumnMergeItem(IColumInfoModel leftColumn, IColumInfoModel rightColumn, MergeStatus mergeStatus) { LeftColumn = leftColumn; RightColumn = rightColumn; MergeStatus = mergeStatus; ColumnMerges = new ThreadSaveObservableCollection<PropertyMergeItem>(); }
public ColumnMergeItem(IColumInfoModel leftColumn, IColumInfoModel rightColumn, MergeStatus mergeStatus) { LeftColumn = leftColumn; RightColumn = rightColumn; MergeStatus = mergeStatus; ColumnMerges = new ThreadSaveObservableCollection <PropertyMergeItem>(); }
public IEnumerable <string> Compare(IColumInfoModel other) { if (this.NewColumnName != other.NewColumnName) { yield return(nameof(NewColumnName)); } if (this.IsRowVersion != other.IsRowVersion) { yield return(nameof(IsRowVersion)); } if (this.IsRowVersion != other.IsRowVersion) { yield return(nameof(IsRowVersion)); } if (this.PrimaryKey != other.PrimaryKey) { yield return(nameof(PrimaryKey)); } if (this.InsertIgnore != other.InsertIgnore) { yield return(nameof(InsertIgnore)); } if (this.EnumDeclaration != other.EnumDeclaration) { yield return(nameof(EnumDeclaration)); } if (this.Exclude != other.Exclude) { yield return(nameof(Exclude)); } if (this.ForgeinKeyDeclarations != other.ForgeinKeyDeclarations) { yield return(nameof(ForgeinKeyDeclarations)); } }
public bool Equals(IColumInfoModel other) { return Equals(ColumnInfo, other.ColumnInfo) && string.Equals(NewColumnName, other.NewColumnName) && IsRowVersion == other.IsRowVersion && PrimaryKey == other.PrimaryKey && InsertIgnore == other.InsertIgnore && Equals(EnumDeclaration, other.EnumDeclaration) && Exclude == other.Exclude && Equals(ForgeinKeyDeclarations, other.ForgeinKeyDeclarations); }
public bool Equals(IColumInfoModel other) { return(Equals(ColumnInfo, other.ColumnInfo) && string.Equals(NewColumnName, other.NewColumnName) && IsRowVersion == other.IsRowVersion && PrimaryKey == other.PrimaryKey && InsertIgnore == other.InsertIgnore && Equals(EnumDeclaration, other.EnumDeclaration) && Exclude == other.Exclude && Equals(ForgeinKeyDeclarations, other.ForgeinKeyDeclarations)); }
public IEnumerable<string> Compare(IColumInfoModel other) { if (this.NewColumnName != other.NewColumnName) yield return nameof(NewColumnName); if (this.IsRowVersion != other.IsRowVersion) yield return nameof(IsRowVersion); if (this.IsRowVersion != other.IsRowVersion) yield return nameof(IsRowVersion); if (this.PrimaryKey != other.PrimaryKey) yield return nameof(PrimaryKey); if (this.InsertIgnore != other.InsertIgnore) yield return nameof(InsertIgnore); if (this.EnumDeclaration != other.EnumDeclaration) yield return nameof(EnumDeclaration); if (this.Exclude != other.Exclude) yield return nameof(Exclude); if (this.ForgeinKeyDeclarations != other.ForgeinKeyDeclarations) yield return nameof(ForgeinKeyDeclarations); }
public void Compare(IColumInfoModel left, IColumInfoModel right) { Result = new ColumnMergeItem(left, right, MergeStatus.Same); var mergeItems = new List<PropertyMergeItem>(); foreach (var source in ColumnInfoModel.Propertys.Where(f => !typeof(IEnumerable).IsAssignableFrom(f.Value.PropertyType))) { var leftValue = source.Value.Getter.Invoke(left); var rightValue = source.Value.Getter.Invoke(right); if (leftValue != rightValue) { mergeItems.Add(new PropertyMergeItem(source.Key, leftValue, rightValue, MergeStatus.NotSame)); } } if (mergeItems.Any()) { Result = new ColumnMergeItem(left,right, MergeStatus.NotSame); Result.ColumnMerges.AddRange(mergeItems); } }
public void Compare(IColumInfoModel left, IColumInfoModel right) { Result = new ColumnMergeItem(left, right, MergeStatus.Same); var mergeItems = new List <PropertyMergeItem>(); foreach (var source in ColumnInfoModel.Propertys.Where(f => !typeof(IEnumerable).IsAssignableFrom(f.Value.PropertyType))) { var leftValue = source.Value.Getter.Invoke(left); var rightValue = source.Value.Getter.Invoke(right); if (leftValue != rightValue) { mergeItems.Add(new PropertyMergeItem(source.Key, leftValue, rightValue, MergeStatus.NotSame)); } } if (mergeItems.Any()) { Result = new ColumnMergeItem(left, right, MergeStatus.NotSame); Result.ColumnMerges.AddRange(mergeItems); } }
public CodeMemberProperty AddProperty(IColumInfoModel info) { var propertyName = info.GetPropertyName(); var targetType = info.ColumnInfo.TargetType; if (info.ColumnInfo.Nullable && !info.ColumnInfo.TargetType.IsClass) { targetType = typeof(Nullable <>).MakeGenericType(targetType); } CodeMemberProperty codeMemberProperty; if (info.EnumDeclaration != null) { codeMemberProperty = AddProperty(propertyName, new CodeTypeReference(info.EnumDeclaration.Name)); //var enumConverter = new ValueConverterAttribute(typeof(EnumMemberConverter)); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(typeof(ValueConverterAttribute).Name, new CodeAttributeArgument(new CodeTypeOfExpression(typeof(EnumMemberConverter))))); } else { codeMemberProperty = AddProperty(propertyName, new CodeTypeReference(targetType)); if (info.IsRowVersion) { var forModel = new RowVersionAttribute(); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(forModel.GetType().Name)); } } if (!string.IsNullOrEmpty(info.NewColumnName)) { var forModel = new ForModelAttribute(info.ColumnInfo.ColumnName); codeMemberProperty.CustomAttributes.Add(new CodeAttributeDeclaration(forModel.GetType().Name, new CodeAttributeArgument(new CodePrimitiveExpression(forModel.AlternatingName)))); } return(codeMemberProperty); }
public IEnumerable <string> Compare(IColumInfoModel other) { return(Model.Compare(other)); }
public ColumnInfoViewModel(IColumInfoModel model) : base(App.Current.Dispatcher) { Model = model; ColumnViewModel = new ColumnViewModel(ColumnInfo); }
public IEnumerable<string> Compare(IColumInfoModel other) { return Model.Compare(other); }
public bool Equals(IColumInfoModel other) { return Model.Equals(other); }
public bool Equals(IColumInfoModel other) { return(Model.Equals(other)); }