Showing posts with label external. Show all posts
Showing posts with label external. Show all posts

Sunday, March 11, 2012

Custom Properties in External Metadata not writeable using the Advanced Editor

Hello,

I'm working on a custom dataflow destination component. It makes use of the External Metadata Collection. I also use Custom Properties with the external metadata collection.

When I open the destination component using the Advanced Editor, and select an External Metadata Collection and change the Custom Property it always changes back to the original value.

Additionally the method SetExternalMetadataColumnProperty never gets called.

Here is a little Test Component that surfaces the problem:

[DtsPipelineComponent(ComponentType=ComponentType.DestinationAdapter, DisplayName="Test Destination")]
public class Class1 : PipelineComponent
{
public override void ProvideComponentProperties()
{
base.ProvideComponentProperties();

ComponentMetaData.InputCollection.RemoveAll();
IDTSInput90 input = ComponentMetaData.InputCollection.New();
input.Name = "Name";
input.ExternalMetadataColumnCollection.IsUsed = true;

IDTSExternalMetadataColumn90 ext = input.ExternalMetadataColumnCollection.New();
ext.Name = "ExtName";
IDTSCustomProperty90 customProp = ext.CustomPropertyCollection.New();
customProp.Name = "Custom Property";
customProp.Value = "Hallo";
}

public override IDTSCustomProperty90 SetExternalMetadataColumnProperty(int iID, int iExternalMetadataColumnID, string strPropertyName, object oValue)
{
return base.SetExternalMetadataColumnProperty(iID, iExternalMetadataColumnID, strPropertyName, oValue);
}
}

Any ideas how to make that work?

Georg

Are you sure that your SetExternalMetadataColumnProperty method is getting called? I believe you must implement the functionality to set the property yourself rather than delegating to the base class.|||

No, actually part of problem is that it never gets called when I change the property.

The method is only implemented for debugging. If you set a breakpoint in it, it never gets called. As far as I understand is, you would override this method just to implement additional functionality when a custom property of an External Metadata Column is changed, eg for validation.

Friday, February 24, 2012

Custom coding

I'm using the Report.References collection to link to some external
Assemblies (developed in C#). Also, I use the Report.Classes collection to
instantiate some classes defined in that assemblies. This works, as I'm
able to show a custom Windows form from the constructors of the instantiated
classes in report initialization time and to get simple values from some
properties. As this approach is extremately useful, I'd like to acquire
maximum flexibility being able to access from these classes to all the
properties of the Report via the corresponding namespaces as follows:
Microsoft.ReportingServices.ReportProcessing
Microsoft.ReportingServices.ReportRendering
As an example, I'd like to access to the Report object, to an existing
Matrix item, etc. I'm trying it this way:
///////////////////////////// C# in the Assembly:
namespace CustomAssembly
{
public class Class1
{
public int
GetRenderedColumnsCount(Microsoft.ReportingServices.ReportRendering.Report
p_Report)
{
return p_Report.Columns;
}
public int
GetMatrixColumnsCount(Microsoft.ReportingServices.ReportRendering.Matrix
p_Matrix)
{
return p_Matrix.Columns;
}
}
}
/////////////////////////////// Report:
First, I reference the Assemblies:
<CodeModules>
<CodeModule>CustomAssembly, Version=1.0.1719.22270, Culture=neutral,
PublicKeyToken=null</CodeModule>
</CodeModules>
Second, I instantiate the Classes:
<Classes>
<Class>
<ClassName>CustomAssembly.Class1</ClassName>
<InstanceName>class1</InstanceName>
</Class>
</Classes>
Last, I tried to use the following expressions in a TextBox.Value but none
of them work:
=Code.class1.GetRenderedColumnsCount(Report)
=Code.class1.GetRenderedColumnsCount(Code.Report)
=Code.class1.GetMatrixColumnsCount(matrix1)
=Code.class1.GetMatrixColumnsCount(Report.matrix1)
=Code.class1.GetMatrixColumnsCount(Report!matrix1)
=Code.class1.GetMatrixColumnsCount(Report("matrix1"))
I'm sure the construction works because I'm showing a MessageBox in the
constructor and other properties are returning the proper value to the
report.
Can anyone, please, tell me what am I doing wrong?Hi.
I had this problem and was able to solve it by following these instructions.
Copy your custom assembly from your build location to the report server bin
folder or the Report Designer folder. The default location of the bin folder
for the report server is C:\Program Files\Microsoft SQL
Server\MSSQL\Reporting Services\ReportServer\bin. The default location of the
Report Designer is C:\Program Files\Microsoft SQL Server\80\Tools\Report
Designer.
It should then work
Christina
"Al Santamaria" wrote:
> I'm using the Report.References collection to link to some external
> Assemblies (developed in C#). Also, I use the Report.Classes collection to
> instantiate some classes defined in that assemblies. This works, as I'm
> able to show a custom Windows form from the constructors of the instantiated
> classes in report initialization time and to get simple values from some
> properties. As this approach is extremately useful, I'd like to acquire
> maximum flexibility being able to access from these classes to all the
> properties of the Report via the corresponding namespaces as follows:
> Microsoft.ReportingServices.ReportProcessing
> Microsoft.ReportingServices.ReportRendering
> As an example, I'd like to access to the Report object, to an existing
> Matrix item, etc. I'm trying it this way:
> ///////////////////////////// C# in the Assembly:
> namespace CustomAssembly
> {
> public class Class1
> {
> public int
> GetRenderedColumnsCount(Microsoft.ReportingServices.ReportRendering.Report
> p_Report)
> {
> return p_Report.Columns;
> }
> public int
> GetMatrixColumnsCount(Microsoft.ReportingServices.ReportRendering.Matrix
> p_Matrix)
> {
> return p_Matrix.Columns;
> }
> }
> }
> /////////////////////////////// Report:
> First, I reference the Assemblies:
> <CodeModules>
> <CodeModule>CustomAssembly, Version=1.0.1719.22270, Culture=neutral,
> PublicKeyToken=null</CodeModule>
> </CodeModules>
> Second, I instantiate the Classes:
> <Classes>
> <Class>
> <ClassName>CustomAssembly.Class1</ClassName>
> <InstanceName>class1</InstanceName>
> </Class>
> </Classes>
> Last, I tried to use the following expressions in a TextBox.Value but none
> of them work:
> =Code.class1.GetRenderedColumnsCount(Report)
> =Code.class1.GetRenderedColumnsCount(Code.Report)
> =Code.class1.GetMatrixColumnsCount(matrix1)
> =Code.class1.GetMatrixColumnsCount(Report.matrix1)
> =Code.class1.GetMatrixColumnsCount(Report!matrix1)
> =Code.class1.GetMatrixColumnsCount(Report("matrix1"))
> I'm sure the construction works because I'm showing a MessageBox in the
> constructor and other properties are returning the proper value to the
> report.
> Can anyone, please, tell me what am I doing wrong?
>
>

Sunday, February 19, 2012

Custom Assembly Problems: System.Drawing

Hi,
I built a Custom Assembly to allow me to use external image files in
my report. I deployed the DLL and configured the security policy
config files.
Everything worked great, i got the image coming through to my report
in both Designer Preview mode and when deployed.
I decided to extend the custom assembly to return the dimensions of
the image as well by adding some code that utilizes System.Drawing.DLL
//ok now, lets get the width and height
//FileIOPermission permission = new FileIOPermission
Image myImage = Image.FromFile(pPath);
g_lastHeight = myImage.Height;
g_lastWidth = myImage.Width;
myImage.Dispose();
myImage=null;
After rebuilding and deploying the DLL, my report no longer has any
images when deployed.
However, the images do show up in Designer preview mode, and the DLL
performs correctly returning the image dimensions upon request,
implying a security policy issue'
So my question is what security policy type things do i need to do in
order to utilize System.Drawing.dll in my DLL.
Any help would be greatly appreciated.
Thanks
DerekI believe the correct permission is UIPermission. Please see the following for why it only works in
preview and how to configure the server:
http://msdn.microsoft.com/library/?url=/library/en-us/dnsql2k/html/dngrfCodeAccessSecurityInSQLServer2000ReportingServices.asp?frame=true
Thanks.
Donovan R. Smith
Software Test Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
"Derek W" <derek@.brokerbuilders.com> wrote in message
news:a5df538d.0408161409.6d219516@.posting.google.com...
> Hi,
> I built a Custom Assembly to allow me to use external image files in
> my report. I deployed the DLL and configured the security policy
> config files.
> Everything worked great, i got the image coming through to my report
> in both Designer Preview mode and when deployed.
> I decided to extend the custom assembly to return the dimensions of
> the image as well by adding some code that utilizes System.Drawing.DLL
> //ok now, lets get the width and height
> //FileIOPermission permission = new FileIOPermission
> Image myImage = Image.FromFile(pPath);
> g_lastHeight = myImage.Height;
> g_lastWidth = myImage.Width;
> myImage.Dispose();
> myImage=null;
> After rebuilding and deploying the DLL, my report no longer has any
> images when deployed.
> However, the images do show up in Designer preview mode, and the DLL
> performs correctly returning the image dimensions upon request,
> implying a security policy issue'
> So my question is what security policy type things do i need to do in
> order to utilize System.Drawing.dll in my DLL.
> Any help would be greatly appreciated.
> Thanks
> Derek

Custom assembly on report.

I am using an external assembly on one of my report. This assembly simply
does some data reading, does some calculation, and updating a table, and is
working fine if called directly from an aspx page. However, if I call the
assembly from my report it fails with an error below:
Reporting Services Error
----
Failed to load expression host assembly. Details: Request for the permission
of type System.Data.SqlClient.SqlClientPermission, System.Data,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
(rsProcessingError)
----
I have given my assembly FullTrust permission in rsrvrpolicy.config.
System.Data.dll was also given FullTrust permission, but this did not solve
the problem.
FYI, my assembly was not written as a Reporting Services custom data
extension. I did not think about implementing one since the assembly itself
does not supply the data to my report. My report is still using a shared
data source defined in the report project.
Do I need to rewrite my assembly to a Reporting Services data extension
(using the data interfaces) for it to work with my reports?
Any help would be much appreciated. TIA.It sounds like you did not explicitly assert permissions to open a database
connection. Unless you assert (!) the permission explicitly in the custom
assembly code, it will fail with a security exception.
Example for opening a connection to a SQL Server:
...
SqlClientPermission permission = new
SqlClientPermission(PermissionState.Unrestricted);
try
{
permission.Assert(); // Assert security permission!
SqlConnection con = new SqlConnection("...");
con.Open();
...
}
BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
because the SqlClient is enabled for partial trust scenarios. Unlike the
OracleClient - in case you are interested in the details about the
differences:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
--
Robert M. Bruckner
Microsoft SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"TechnoSpyke" <technospyke@.yahoo.com> wrote in message
news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> I am using an external assembly on one of my report. This assembly simply
> does some data reading, does some calculation, and updating a table, and
is
> working fine if called directly from an aspx page. However, if I call the
> assembly from my report it fails with an error below:
> Reporting Services Error
> ----
--
> Failed to load expression host assembly. Details: Request for the
permission
> of type System.Data.SqlClient.SqlClientPermission, System.Data,
> Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> (rsProcessingError)
> ----
--
> I have given my assembly FullTrust permission in rsrvrpolicy.config.
> System.Data.dll was also given FullTrust permission, but this did not
solve
> the problem.
> FYI, my assembly was not written as a Reporting Services custom data
> extension. I did not think about implementing one since the assembly
itself
> does not supply the data to my report. My report is still using a shared
> data source defined in the report project.
> Do I need to rewrite my assembly to a Reporting Services data extension
> (using the data interfaces) for it to work with my reports?
> Any help would be much appreciated. TIA.
>|||Hi Robert,
I have a custom assembly with 2 functions one using SqlClient for dataaccess
as below which is working fine with the assert, but I also have one using
System.DirectoryServices which i am trying to use with:
System.DirectoryServices.DirectoryServicesPermission pDir = new
DirectoryServicesPermission(System.Security.Permissions.PermissionState.Unrestricted);
pDir.Assert();
Unfortunately i am getting the following error:
"Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed."
Any ideas?
I cant seem to solve this one and there doesnt seem to be any help anywhere.
Thanks,
Flon Mackenzie
"Robert Bruckner [MSFT]" wrote:
> It sounds like you did not explicitly assert permissions to open a database
> connection. Unless you assert (!) the permission explicitly in the custom
> assembly code, it will fail with a security exception.
> Example for opening a connection to a SQL Server:
> ...
> SqlClientPermission permission = new
> SqlClientPermission(PermissionState.Unrestricted);
> try
> {
> permission.Assert(); // Assert security permission!
> SqlConnection con = new SqlConnection("...");
> con.Open();
> ...
> }
> BTW: you don't need FullTrust for using the SqlClient in a custom assembly,
> because the SqlClient is enabled for partial trust scenarios. Unlike the
> OracleClient - in case you are interested in the details about the
> differences:
> http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=876d1ca1-b59f-4c77-9b06-2cd307aa951c&sloc=en-us
> --
> Robert M. Bruckner
> Microsoft SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "TechnoSpyke" <technospyke@.yahoo.com> wrote in message
> news:%23$%23U$XVBFHA.2196@.TK2MSFTNGP14.phx.gbl...
> > I am using an external assembly on one of my report. This assembly simply
> > does some data reading, does some calculation, and updating a table, and
> is
> > working fine if called directly from an aspx page. However, if I call the
> > assembly from my report it fails with an error below:
> >
> > Reporting Services Error
> > ----
> --
> >
> > Failed to load expression host assembly. Details: Request for the
> permission
> > of type System.Data.SqlClient.SqlClientPermission, System.Data,
> > Version=1.0.5000.0, Culture=neutral, PublicKeyToken=... failed.
> > (rsProcessingError)
> >
> > ----
> --
> >
> > I have given my assembly FullTrust permission in rsrvrpolicy.config.
> > System.Data.dll was also given FullTrust permission, but this did not
> solve
> > the problem.
> >
> > FYI, my assembly was not written as a Reporting Services custom data
> > extension. I did not think about implementing one since the assembly
> itself
> > does not supply the data to my report. My report is still using a shared
> > data source defined in the report project.
> >
> > Do I need to rewrite my assembly to a Reporting Services data extension
> > (using the data interfaces) for it to work with my reports?
> >
> > Any help would be much appreciated. TIA.
> >
> >
>
>

Friday, February 17, 2012

Custom Assemblies

Hi,
I had an external assembly for which i had added the reference in the
report.When i view the report in PREVIEW section the report is displyed
properly with the data but when i review in browser the report is shown with
error as "Security Error" where i am referencing the external DLL. Can
anybody tell me how to set security for the external DLL.
Thanks
JasvinderLook at this thread, you have to get Reporting Services trust your DLL.
http://groups.google.de/groups?hl=de&lr=&threadm=OAxg3EQRFHA.4028%40tk2msftngp13.phx.gbl&rnum=1&prev=/groups%3Fq%3Dreporting%2Bservices%2Bassembly%2Bgac%26hl%3Dde%26lr%3D%26scoring%3Dd%26selm%3DOAxg3EQRFHA.4028%2540tk2msftngp13.phx.gbl%26rnum%3D1
HTH, Jens Suessmeyer.
--
http://www.sqlserver2005.de
--
"Jasvinder" <Jasvinder@.discussions.microsoft.com> schrieb im Newsbeitrag
news:7800CAD7-7871-4104-B175-9FC2133CAC9A@.microsoft.com...
> Hi,
> I had an external assembly for which i had added the reference in the
> report.When i view the report in PREVIEW section the report is displyed
> properly with the data but when i review in browser the report is shown
> with
> error as "Security Error" where i am referencing the external DLL. Can
> anybody tell me how to set security for the external DLL.
> Thanks
> Jasvinder