Virtualdatasource.md
... ...
@@ -1,6 +1,26 @@
1 1
If you wish to use one of the reports already created as a data source instead of existing tables:
2 2
3 3
1 -- Set AdHocSettings.AllowVirtualDataSources = true;
4
+
5
+```csharp
6
+//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
7
+public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig
8
+{
9
+ // Configure settings
10
+ // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method
11
+ public static void InitializeReporting() {
12
+ //Check to see if we've already initialized.
13
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
14
+ return;
15
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
16
+ //Creates a connection to Microsoft SQL Server
17
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
18
+ Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig();
19
+ HttpContext.Current.Session["ReportingInitialized"] = true;
20
+ AdHocSettings.AllowVirtualDataSources = true; //The relevant setting
21
+ }
22
+```
23
+
4 24
2 -- Create a report as usual
5 25
3 -- In Misc. Tab, near the bottom click the checkbox that says, "Expose as data source."
6 26