Extended report service: extended report service based on WCF Technology

Source: Internet
Author: User
Tags knowledge base

I have been advocating this technology for a long time. Today I have the opportunity to present it.
Why is expansion required? The purpose of expansion is to integrate with your existing system. For example, the existing system is already very complex and can handle a lot of businesses. The developers of the design system did not fully consider the technical changes. When a new technology is launched, in order to apply the new technology to the old system, we need to expand new technologies to facilitate their application to our existing systems.
it is stupid to follow the new technology to change the system. Taking the example as an example, at the beginning, the system used remoting as the communication framework. After the emergence of WCF, it re-wrote its own system using the WCF technology. This approach is tiring, and the stability of the system is greatly reduced due to accidental changes to the business.
new technologies generally have extended interfaces and methods, fully researched new technologies, and expanded writing points. This method is not only convenient to use new technologies, but also without making any changes to the current system. It is recommended to you. Of course, as a master Program member, you generally have to spend several weekends studying new technologies and extension) class knowledge base and Article . Generally, the answer can be found through a foreigner's english blog. The division of labor among people is fine, which is naturally better in all aspects.
for reports, an XSD architecture file is generated directly using SQL statements, which contains fields. Drag the field to the report to form a report design file, and send data to the report at runtime. The method described here is to wrap the SQL statement into A. Net assembly and design the report by calling assembly and indirectly calling SQL.
with data processing extensions, I also learned how to retrieve data fields from Web Services and apply them to report design. This article describes how to fetch data from the. NET Server and apply it to report design.

Objective: To build a toolbox for report design and development
A WCF-based server that captures data. The report designer sends a query statement request to the server to accept the returned values of the server.
The original SQL query statement is written as follows:

Now let's replace this statement for database query.

That is, how to write a query statement.
Assembly = tracking. Report. quotation;
Class = tracking. Report. quotation;
Method = getcustomerlist (@ customer );
The rest of the report production and deployment steps remain unchanged. I changed the data processing part.

Benefits: give full play to the t_ SQL set computing capability and the power of C # In numerical computation and string processing
In particular, some calculations and string processing may be inconvenient to use SQL statements, and many t_ SQL statements need to be written.Code. However, if this method is used to give full play to the advantages of the programming language (C #) and database language (t_ SQL), and use t_ SQL to process the set operation part, computing and character text processing are left in the C # code.

Design Extension Project Data Process extension (Class Library)

If you are not familiar with the interfaces and methods, please refer to my article,
Reporting Services Extension: Full guide to file share data processing Extension
It is used to warm up the article.

Console Project)

It only has one program file, and the code is as follows:

This is the code to open the server. It is usually appropriate to convert the console project type to Windows Services.
To facilitate debugging of extended projects, I first write a test client project to facilitate debugging of problems.

Extended project test client (console)

The main code is as follows:
Class Program
{
Static void main (string [] ARGs)
{

Channelfactory <iservicemanager> SCF;
SCF = new channelfactory <iservicemanager> (
New nettcpbinding (), "net. TCP: // localhost: 4000/reporting ");
Iservicemanager S;
S = SCF. createchannel ();
String Assembly = "tracking. Report. quotation ";
String cClass = "tracking. Report. quotation ";
String method = "getcustomerlist ";
Object [] Arg = new object [] {"tradh "};
Dataset DS = S. getdataset (assembly, cClass, method, ARG );
If (Ds! = NULL)
Console. writeline ("Get data: {0}", DS. Tables [0]. Rows. Count );
Console. Readline ();
}
}
Open the Report Server and run this project to verify that the server and client can communicate normally.

To run any extension-related program, you must first open the server.

Query a project (Class Library)
This project encapsulates SQL statements into an assembly for the Report Server to call and return the dataset to the client.
The quotation class code is as follows:

You may have noticed that the getcustomerlist method is the C # encapsulation of the following SQL statement.
Select [customerid], [companyName], [contactname]
, [Contacttitle], [address], [City]
, [Region], [postalcode], [Country]
, [PHONE], [Fax]
From [northwind]. [DBO]. [MERs]
Where customerid = @ customerid
So far, all server-side projects have been designed, and you need to deploy the extension project.
If you are not familiar with the deployment of extension, refer to this article.
Reporting Services Extension: Full guide to file share data processing Extension

Next, go to the Application Development Section, open bids, create a report project, and add report items.
In the data connection string section, select extension and enter the local server address as the connection string.

Write query statement

Execute the query and refresh the fields to design the report.

The following steps are no different from the common report development method.
Go to the layout page and design the report.

Preview The effect. Enter the customerid: tradh parameter.

In this way, the report design extension of this structure is finally realized.

I have also compiled the following articles about report design and development:
Implement a reporting services project in multiple languages to explain the design methods related to the globalization of reports.
If you are not familiar with basic report development and design processes, here is a detailed introduction
Detailed description of ASP. NET rdlc report development
If you have any problems during deployment, refer to this article.
An error occurred while deploying the ASPX page of a control containing reportview.
This series of articles is messy and not systematic.

A friend in the garden asked for a development tutorial or summary on reporting services. This is a good idea. A long time ago, there was a report expert in the garden: wax Man Zhang. At that time, I gradually became familiar with the reporting services technology after reading his article. I really appreciate these selfless friends.
For more information about forms authentication, see this friend's article:
Implement Form Verification for sql2008 Reporting Service

There are other extensions. For example, you can create a report item extension and a barcode as a report item. Like common tables and matrices, It is reused by reports. You can refer to the polygonscustomreportitem project to integrate Barcode Technology into reporting services.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.