📜 ⬆️ ⬇️

Writing high-load corporate solutions on SharePoint

Good day, dear habrovchane!

In this article I want to describe what to do if you decide to write a high-load corporate solution on SharePoint, and show the implementation of the above using the example of the EOS for Sharepoint 3.5 solution.

For those who do not like to read a lot, briefly follow the link:
')


The Sharepoint approach has its advantages: for storing unstructured data, the Sharepoint database schema fits quite well and, using the additional tools of Sharepoint Server, create a powerful core. A portal for a large organization does not seem to be very difficult.

But if the solution should work on SP Foundation and process large volumes of structured data (for example, document cards and related assignments, journals, files), you will have to use external data sources anyway.

The most suitable and “native” for Sharepoint storage options in external databases is the use of BCS and ServiceApplications . For many reasons, the developers of EOS (and not only them) refuse to use BCS , so this article will focus on creating a database in a service application.

The development of the part of the solution responsible for the work in the external database can be divided into several major stages, each of which I will briefly describe.

Step 1. Create a service application.

As they say on MSDN, “Creating your own SharePoint Server 2010 service applications is not a trivial task” and requires a good understanding of the Sharepoint architecture, but as a reward, a Sharepoint-style solution, scalability and transparency for the administrator.

A full description of the algorithm for creating a service application is beyond the scope of the article; for those who want to learn, there is some information on MSDN .

To create your service application, you need to create a class inherited from SPServiceApplication. For example, in EOS4SP 3.5 this class looks like this:


After that, you need to create your own database class, inherited from SPDatabase , and this is exactly the place where you can define the structure of the created database (or, more precisely, insert references to your scripts to create the database). To do this, override the Provision method (example of implementation in EOS4SP in the figure below) and run the built-in SPDatabase.Provision in it with the necessary parameters:


Stage 2. Synchronization of data in the database with Sharepoint lists.

Synchronization can be divided into primary and permanent. From the primary, I think everything is clear (you can, for example, add a page with a handler to the central administration), but with a constant — everything depends on needs — you can put it in TimerJob , but it will be faster to update the record in the database simultaneously with the list item, in EventReceiver or in redefined FormTemplates buttons.

In EOS4SP 3.5, for example, both mechanisms are involved:
  1. Overriding the SaveButton button in the form of a content type calls the SaveItem method of the EServiceAccess class (a class for processing data in the database).
  2. To delete an item, use EventReceiver , which calls the DeleteItem method of the EServiceAccess class:


Thus, during continuous synchronization, data in Sharepoint lists can be duplicated in an external table and can be obtained quickly or very quickly.

Step 3. Retrieving and displaying data from an external database

When the data is loaded into the database, you need to consider the mechanism of their display. There are no clear instructions here, a ASP .NET developer can choose any convenient mechanism ( GridView , for example), but it is still preferable to use Sharepoint controls and put them into linked web parts. For example, the web part for displaying data and the web part of the filter can be located on the same page and connected to each other, just as it is done in EOS for SharePoint. If you make the control similar to XSLTViewWebPart , then it will be quite good, but it is not easy, and not always justified.

That is, in fact, all that is needed for successful operation of a solution with an external database. The result is:

Source: https://habr.com/ru/post/210844/


All Articles