/// <summary> /// 根据Schema得到属性信息 /// </summary> /// <param name="schemaType"></param> /// <returns></returns> public SchemaMappingInfo GetSchemaMappingInfo(string schemaType) { this.ContainsKey(schemaType).FalseThrow("不能找到Schema为{0}的属性映射信息", schemaType); SchemaMappingConfigurationElement mappingElement = this[schemaType]; SchemaMappingInfo result = mappingElement.GetSchemaMappingInfo(); MergeInheritedElement(result, mappingElement); return(result); }
/// <summary> /// 属性映射信息 /// </summary> /// <returns></returns> public SchemaMappingInfo GetSchemaMappingInfo() { SchemaMappingInfo result = new SchemaMappingInfo() { Name = this.Name, ComparerName = this.ComparerName, Prefix = this.Prefix }; result.ModifyOperations.CopyFrom(this.ModifyOperations); result.ComparedProperties.CopyFrom(this.ComparedProperties); result.ModifiedProperties.CopyFrom(this.ModifiedProperties); return(result); }
private void MergeInheritedElement(SchemaMappingInfo mappingInfo, SchemaMappingConfigurationElement mappingElement) { if (mappingElement.Inherited.IsNotEmpty()) { this.ContainsKey(mappingElement.Inherited).FalseThrow("不能找到Schema为{0}的属性映射信息", mappingElement.Inherited); SchemaMappingConfigurationElement inheritedMappingElement = this[mappingElement.Inherited]; mappingInfo.ComparedProperties.CopyFrom(inheritedMappingElement.ComparedProperties); mappingInfo.ModifiedProperties.CopyFrom(inheritedMappingElement.ModifiedProperties); MergeInheritedElement(mappingInfo, inheritedMappingElement); } }