public static void Convert(ObjectModifyType modifyType, IOguObject srcObject, DirectoryEntry targetObject) { SchemaType schemaType = GetOguSchemaType(targetObject); OguAndADObjectSetterBase setter = GetSetter(modifyType, schemaType); if (setter != null) { SchemaMappingInfo mappingInfo = PermissionCenterToADSynchronizeSettings.GetConfig().SchemaMappings.GetSchemaMappingInfo(schemaType.ToString()); string context = string.Empty; if (mappingInfo.ModifyOperations.ContainsKey(modifyType.ToString())) { SetterObjectMappingConfigurationElement objSetterMappingElement = mappingInfo.ModifyOperations[modifyType.ToString()]; context = objSetterMappingElement.Context; } setter.Convert(modifyType, srcObject, targetObject, context); } }
private static OguAndADObjectSetterBase GetSetter(ObjectModifyType modifyType, SchemaType schemaType) { string schemaTypeName = schemaType.ToString(); string cacheKey = "OguAndADObjectSetterBase" + "-" + modifyType.ToString() + "+" + schemaTypeName; return((OguAndADObjectSetterBase)ObjectContextCache.Instance.GetOrAddNewValue(cacheKey, (cache, key) => { SchemaMappingInfo mappingInfo = PermissionCenterToADSynchronizeSettings.GetConfig().SchemaMappings.GetSchemaMappingInfo(schemaTypeName); OguAndADObjectSetterBase setter = null; if (mappingInfo.ModifyOperations.ContainsKey(modifyType.ToString())) { SetterObjectMappingConfigurationElement objSetterMappingElement = mappingInfo.ModifyOperations[modifyType.ToString()]; setter = (OguAndADObjectSetterBase)PropertySettersSettings.GetConfig().ObjectSetters[objSetterMappingElement.OperationName].CreateInstance(); } cache.Add(cacheKey, setter); return setter; })); }