dc114ab3840c225c82ec073c2cb553c218a201bc
Guides/Izenda-AdHoc-Driver.md
| ... | ... | @@ -13,10 +13,11 @@ 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. |
|
| 18 | 17 | |
| 19 | -####3. Create new class and inherit MSSQLDriver: |
|
| 18 | +2. Add Izenda.AdHoc.dll to the References in the project. |
|
| 19 | + |
|
| 20 | +3. Create new class and inherit MSSQLDriver: |
|
| 20 | 21 | ```csharp |
| 21 | 22 | using Izenda.AdHoc.Database; |
| 22 | 23 | namespace CustomDriver |
| ... | ... | @@ -26,9 +27,9 @@ namespace CustomDriver |
| 26 | 27 | } |
| 27 | 28 | } |
| 28 | 29 | ``` |
| 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 | +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 | 31 | |
| 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 | +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 | 33 | ```csharp |
| 33 | 34 | public override Table[] GetAllTables() |
| 34 | 35 | { |
| ... | ... | @@ -38,7 +39,7 @@ public override Table[] GetAllTables() |
| 38 | 39 | } |
| 39 | 40 | ``` |
| 40 | 41 | |
| 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 | +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 | 43 | |
| 43 | 44 | ```csharp |
| 44 | 45 | public override Column[] GetColumns(Table table) |
| ... | ... | @@ -57,13 +58,13 @@ public override Column[] GetColumns(Table table) |
| 57 | 58 | |
| 58 | 59 | The overridden fields can be seen in the Fields tab on the Report Designer after selecting the DataSource "Products" at the DataSources tab. |
| 59 | 60 | |
| 60 | -####5. Include a reference to your ``CustomDriver`` to your website. To perform this, the following steps should be taken: |
|
| 61 | +5. Include a reference to your ``CustomDriver`` to your website. To perform this, the following steps should be taken: |
|
| 61 | 62 | |
| 62 | -#####a) Compile your ``CustomDriver`` project and copy the assembly to your website's /bin folder, and add the reference just like above. |
|
| 63 | +a) Compile your ``CustomDriver`` project and copy the assembly to your website's /bin folder, and add the reference just like above. |
|
| 63 | 64 | |
| 64 | -#####b) Set ``AdHocContext.Driver = new CustomDriver`` in the ``Session_Start()`` or ``Application_Start()`` method. |
|
| 65 | +b) Set ``AdHocContext.Driver = new CustomDriver`` in the ``Session_Start()`` or ``Application_Start()`` method. |
|
| 65 | 66 | |
| 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 | +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 | 68 | |
| 68 | 69 | To override this method, simply add following method to the MyCustomDriver class: |
| 69 | 70 |