Showing posts with label component. Show all posts
Showing posts with label component. Show all posts

Wednesday, March 28, 2012

Saving Packages and Custom Component data

I am looking for some advice regarding saving custom component data when saving packages.

For custom "properties", this is not an issue, as saving the package will save these properties. Howver, I also have information for each column (besides the properties that columns provides, like Name and DataType) that I need to save if a package were to be saved, and right now it does not save because I am using my own objects to store the data.

I am wondering as to how I can save this information. I have looked up on serialization, but I would like to know if there is another way besides serialization to save this inforamtion as I'd rather not save this to a seperate file.

ThanksI think I found another method, and this method would make more sense...

There is a topic in msdn about persisting custom objects and implementing SaveToXml and LoadFromXml methods. The only problem is that this topic is vague and not very helpful for me in determing how to use this. If anybody can point me to some good documentation, or that could explain it here that would be greatly appreciated.

I have my own class, and I created my own custom object. I have many instances of this object stored currently in a Hashtable. I want to be able to save this.

Thanks|||Search Books Online for "Persisting Custom Objects" (under SSIS). You will either have to implement ISerializable, or write your own routines to save your custom objects as XML.|||Thanks for your reply.

I actually stumbled on a different solution that I have tested and works great.

Because the data that I wanted to save was for each output column, I created custom properties in the IDTSOutputColumn90.CustomPropertyCollection

These custom properties are automatically saved in the XML for you.

Considering that I've been working with custom properties for the actual component I was a little surprise that I did not pick up on creating custom properties for output columns earlier.

Wednesday, March 21, 2012

saved package gets corrupted

Hi,

I am facing a problem. I have custom data flow transformation.We have saved a package using component's earlier assembly version. Now when we install later version of the component the saved package fails to open. If I try creating new package it succeeds.

Error message :

Error 1 Validation error. Data Flow Task: DTS.Pipeline: The component metadata for "component "Oracle Destination" (153)" could not be upgraded to the newer version of the component. The PerformUpgrade method failed. Package.dtsx 0 0

We tried overriding "perform upgrade" method but still I am facing the same issue.

Dharmbir

There is a good sample on how to overridfe PerformUpgrade here:

http://msdn2.microsoft.com/ko-kr/library/ms345168.aspx

The minimal thing that you need to do in the PerformUpgrade method is to upgrade the version (see the last line of code in the link above)

Thanks,
Ovidiu

|||

Hi,

I implemented this, still I am getting the error.

If I have earlier version of the Component in the GAC it does not give me the error and component runs. But if I have only the latest version of the assembly in the GAC it gives me error, though I have gaced its policy file also.

thanks

Dharmbir

|||

You can automatically upgrade a dataflow component's metadata when you upgrade the component's assembly version.

1. Remove the old assembly from GAC.

2. Make sure your new component's CurrentVersion argument of the DtsPipelineComponent attribute is greater than the one saved in the old metadata. That'll ensure that PerformUpgrade of the new component will be called when SSIS opens the package.

3. In the new component override PerformUpgrade and in it make sure to include the following:

ComponentMetaData.CustomPropertyCollection["UserComponentTypeName"].Value = this.GetType().AssemblyQualifiedName;

This changes the metadata's type reference to refer to the new type and version. This will ensure that things like doubleclick on the component will work if you're using UITypeName argument of DtsPipelineComponent attribute for example.
Of course here you should also upgrade any metadata properties from the old version to the new one, including any UITypeEditor properties of custom properties which have their custom editors.

4. Install the new assembly to the GAC.

5. Create a policy assembly redirecting the old version to the new one and install it in GAC. For example of how to do that see here: http://samples.gotdotnet.com/quickstart/howto/doc/pubpolicy.aspx

Now when you open packages with the old version the pattern above will automatically upgrade to the new version.

Milen

sql

saved package gets corrupted

Hi,

I am facing a problem. I have custom data flow transformation.We have saved a package using component's earlier assembly version. Now when we install later version of the component the saved package fails to open. If I try creating new package it succeeds.

Error message :

Error 1 Validation error. Data Flow Task: DTS.Pipeline: The component metadata for "component "Oracle Destination" (153)" could not be upgraded to the newer version of the component. The PerformUpgrade method failed. Package.dtsx 0 0

We tried overriding "perform upgrade" method but still I am facing the same issue.

Dharmbir

There is a good sample on how to overridfe PerformUpgrade here:

http://msdn2.microsoft.com/ko-kr/library/ms345168.aspx

The minimal thing that you need to do in the PerformUpgrade method is to upgrade the version (see the last line of code in the link above)

Thanks,
Ovidiu

|||

Hi,

I implemented this, still I am getting the error.

If I have earlier version of the Component in the GAC it does not give me the error and component runs. But if I have only the latest version of the assembly in the GAC it gives me error, though I have gaced its policy file also.

thanks

Dharmbir

|||

You can automatically upgrade a dataflow component's metadata when you upgrade the component's assembly version.

1. Remove the old assembly from GAC.

2. Make sure your new component's CurrentVersion argument of the DtsPipelineComponent attribute is greater than the one saved in the old metadata. That'll ensure that PerformUpgrade of the new component will be called when SSIS opens the package.

3. In the new component override PerformUpgrade and in it make sure to include the following:

ComponentMetaData.CustomPropertyCollection["UserComponentTypeName"].Value = this.GetType().AssemblyQualifiedName;

This changes the metadata's type reference to refer to the new type and version. This will ensure that things like doubleclick on the component will work if you're using UITypeName argument of DtsPipelineComponent attribute for example.
Of course here you should also upgrade any metadata properties from the old version to the new one, including any UITypeEditor properties of custom properties which have their custom editors.

4. Install the new assembly to the GAC.

5. Create a policy assembly redirecting the old version to the new one and install it in GAC. For example of how to do that see here: http://samples.gotdotnet.com/quickstart/howto/doc/pubpolicy.aspx

Now when you open packages with the old version the pattern above will automatically upgrade to the new version.

Milen

Tuesday, March 20, 2012

Save time in Script Component which is almost forwarding

Hi,
I have to add the fields coming from the source AS IS but, I need to add current date as a column to it. So, What I do is to add an Script Component and add each and every output column in that along with defining their types and writing an "assignments" script.

Is there any possibility for me to save time in the scenarios where I am almost passing on the information to next level in the data flow ?

Any input regarding this will sincerely be appreciated.

FahadWhy can't you use a derived column transformation with getdate() as an expression? Using a derived column, you can add a new date column to your data flow.|||Thanks, I appreciate it.