/// <summary> /// Provides the component properties /// </summary> public override void ProvideComponentProperties() { base.ProvideComponentProperties(); _IsagCustomProperties = new IsagCustomProperties(); _IsagCustomProperties.SetDefaultValues(); ComponentMetaDataTools.UpdateVersion(this, ComponentMetaData); //Set metadata version to DLL-Version DtsPipelineComponentAttribute componentAttr = (DtsPipelineComponentAttribute)Attribute.GetCustomAttribute(this.GetType(), typeof(DtsPipelineComponentAttribute), false); int binaryVersion = componentAttr.CurrentVersion; ComponentMetaData.Version = binaryVersion; //Clear out base implmentation this.ComponentMetaData.RuntimeConnectionCollection.RemoveAll(); this.ComponentMetaData.InputCollection.RemoveAll(); this.ComponentMetaData.OutputCollection.RemoveAll(); //Input IDTSInput100 input = this.ComponentMetaData.InputCollection.New(); input.Name = Constants.INPUT_NAME; input.Description = Constants.INPUT_NAME; input.HasSideEffects = true; //New connection managers IDTSRuntimeConnection100 conn = this.ComponentMetaData.RuntimeConnectionCollection.New(); conn.Name = Constants.CONNECTION_MANAGER_NAME_MAIN; conn.Description = "Main Connection to SQL Server"; //Custom Properties hinzufügen IDTSCustomProperty100 prop = ComponentMetaData.CustomPropertyCollection.New(); prop.Name = Constants.PROP_CONFIG; _IsagCustomProperties.Save(ComponentMetaData); }
/// <summary> /// load this properties from an xml string (taken from component metadatas custom properties /// and loads standard configuration if needed /// </summary> /// <param name="componentMetaData">the components metddata</param> /// <param name="needsStandardConfiguration">Is standard configuration needed?</param> /// <returns>instance of IsagCustomProperties</returns> public static IsagCustomProperties Load(IDTSComponentMetaData100 componentMetaData, bool needsStandardConfiguration) { IsagCustomProperties properties; try { properties = LoadFromXml(componentMetaData.CustomPropertyCollection[Constants.PROP_CONFIG].Value.ToString()); } catch (Exception ex) { if (!needsStandardConfiguration) { properties = new IsagCustomProperties(); properties.SetDefaultValues(); } else { throw new Exception("Cannot load the Configuration: " + ex.Message); } } try { StandardConfiguration stdConfiguration = new StandardConfiguration(componentMetaData.RuntimeConnectionCollection, properties.AutoUpdateStandardConfiguration); stdConfiguration.SetStandardConfiguration(ref properties); } catch (Exception ex) { if (needsStandardConfiguration) { throw new Exception("Cannot load Standard Configuration: " + ex.Message); } } return(properties); }