3bf4de375342daa0b78ccfcc051b581872b7b683
Guides/Izenda-AdHoc-Driver.md
| ... | ... | @@ -13,10 +13,10 @@ Izenda reports is designed as a modular system to be easily customizable for usa |
| 13 | 13 | |
| 14 | 14 | The ``Izenda.AdHoc.Database.MSSQLDriver`` class implements complete functionality for using MSSQL server as your datasource and also allows you to create inheritors. So the easiest way to create a custom driver working with MSSQL server is to inherit ``Izenda.AdHoc.Database.MSSQLDriver`` and override the functionality you need to work differently. Below are complete instructions detailing how to perform this: |
| 15 | 15 | |
| 16 | -**1.** Create new project with type of Class library in Visual Studio. |
|
| 17 | -**2.** Add Izenda.AdHoc.dll to the References in the project. |
|
| 16 | +####1. Create new project with type of Class library in Visual Studio. |
|
| 17 | +####2. Add Izenda.AdHoc.dll to the References in the project. |
|
| 18 | 18 | |
| 19 | -**3.** Create new class and inherit MSSQLDriver: |
|
| 19 | +####3. Create new class and inherit MSSQLDriver: |
|
| 20 | 20 | ```csharp |
| 21 | 21 | using Izenda.AdHoc.Database; |
| 22 | 22 | namespace CustomDriver |
| ... | ... | @@ -26,9 +26,9 @@ namespace CustomDriver |
| 26 | 26 | } |
| 27 | 27 | } |
| 28 | 28 | ``` |
| 29 | -**4.** Now any metadata drilling functionality can be altered. Here we will implement overriding of two most important methods, assuming that we have a single custom source of data. For our example, we will assume the table **Products** exists with three fields: **Id**, **Name**, and **Price**: |
|
| 29 | +####4. Now any metadata drilling functionality can be altered. Here we will implement overriding of two most important methods, assuming that we have a single custom source of data. For our example, we will assume the table **Products** exists with three fields: **Id**, **Name**, and **Price**: |
|
| 30 | 30 | |
| 31 | -**a)** ``GetAllTables()`` returns an array of ``Izenda.AdHoc.Database.Table`` which will be available in the DataSources tab in the ReportDesigner as a list of datasources. Here is a short example of overriding this method: |
|
| 31 | +#####a) ``GetAllTables()`` returns an array of ``Izenda.AdHoc.Database.Table`` which will be available in the DataSources tab in the ReportDesigner as a list of datasources. Here is a short example of overriding this method: |
|
| 32 | 32 | ```csharp |
| 33 | 33 | public override Table[] GetAllTables() |
| 34 | 34 | { |
| ... | ... | @@ -38,7 +38,7 @@ public override Table[] GetAllTables() |
| 38 | 38 | } |
| 39 | 39 | ``` |
| 40 | 40 | |
| 41 | -**b)** GetColumns returns an array of Izenda.AdHoc.Database.Column for the given table. This array is used as fields list at several tabs in the ReportDesigner. Again, short example of overriding this method: |
|
| 41 | +#####b) GetColumns returns an array of Izenda.AdHoc.Database.Column for the given table. This array is used as fields list at several tabs in the ReportDesigner. Again, short example of overriding this method: |
|
| 42 | 42 | |
| 43 | 43 | ```csharp |
| 44 | 44 | public override Column[] GetColumns(Table table) |
| ... | ... | @@ -57,13 +57,13 @@ public override Column[] GetColumns(Table table) |
| 57 | 57 | |
| 58 | 58 | The overridden fields can be seen in the Fields tab on the Report Designer after selecting the DataSource "Products" at the DataSources tab. |
| 59 | 59 | |
| 60 | -**5.** Include a reference to your ``CustomDriver`` to your website. To perform this, the following steps should be taken: |
|
| 60 | +####5. Include a reference to your ``CustomDriver`` to your website. To perform this, the following steps should be taken: |
|
| 61 | 61 | |
| 62 | -**a)** Compile your ``CustomDriver`` project and copy the assembly to your website's /bin folder, and add the reference just like above. |
|
| 62 | +#####a) Compile your ``CustomDriver`` project and copy the assembly to your website's /bin folder, and add the reference just like above. |
|
| 63 | 63 | |
| 64 | -**b)** Set ``AdHocContext.Driver = new CustomDriver`` in the ``Session_Start()`` or ``Application_Start()`` method. |
|
| 64 | +#####b) Set ``AdHocContext.Driver = new CustomDriver`` in the ``Session_Start()`` or ``Application_Start()`` method. |
|
| 65 | 65 | |
| 66 | -**6.** You must also override some other methods like ``GetDataSet()``. This method accepts a ``System.Data.IDBCommand`` parameter, and returns the corresponding DataSet. Overriding this method allows you to pre-process the dataset before returning it. You may use ``AdHocContext.CurrentReportSet`` to get additional details of the report. For integrations that will not utilize SQL queries in the command object, ``Izenda.AdHoc.AdHocContext.CurrentReportSet`` may be used to get the report state. |
|
| 66 | +####6. You must also override some other methods like ``GetDataSet()``. This method accepts a ``System.Data.IDBCommand`` parameter, and returns the corresponding DataSet. Overriding this method allows you to pre-process the dataset before returning it. You may use ``AdHocContext.CurrentReportSet`` to get additional details of the report. For integrations that will not utilize SQL queries in the command object, ``Izenda.AdHoc.AdHocContext.CurrentReportSet`` may be used to get the report state. |
|
| 67 | 67 | |
| 68 | 68 | To override this method, simply add following method to the MyCustomDriver class: |
| 69 | 69 |