12fb35025a33a48a1d4f2d81e9b6dccdf8171916
API/CodeSamples/LazySpMetadataPulling.md
| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | +#LazySpMetadataPulling |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##About |
|
| 6 | +**Data Type:** boolean |
|
| 7 | +**Accepted Values:** true, false |
|
| 8 | +**Default value:** false |
|
| 9 | +**Impacted Features:** Report Design, Data Sources, InitializeReporting() |
|
| 10 | +**Purpose:** Gets or sets whether stored procedure metadata will be loaded at the same time as metadata for the rest of the schema. When true, stored procedure metadata will only be pulled when the stored procedure is executed. |
|
| 11 | +**Usage:** This setting, when set to true, is used to prevent Izenda from executing all stored procedures in VisibleDataSources on the database at initialization. |
|
| 12 | +**Caveats:** Initialization will be quicker when LazySpMetadataPulling is set to true, but individual reports may take longer to load (if the stored procedure has not been executed and cached by Izenda). |
|
| 13 | + |
|
| 14 | +##Code Samples |
|
| 15 | +###Global.asax (C♯) |
|
| 16 | + |
|
| 17 | +```csharp |
|
| 18 | +//main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 19 | +public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig |
|
| 20 | +{ |
|
| 21 | + // Configure settings |
|
| 22 | + // Add custom settings after setting the license key and connection string by overriding the ConfigureSettings() method |
|
| 23 | + public static void InitializeReporting() { |
|
| 24 | + //Check to see if we've already initialized. |
|
| 25 | + if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null) |
|
| 26 | + return; |
|
| 27 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"; |
|
| 28 | + //Creates a connection to Microsoft SQL Server |
|
| 29 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"; |
|
| 30 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = new CustomAdHocConfig(); |
|
| 31 | + AdHocSettings.LazySpMetadataPulling = true; //The relevant setting -- must be set PRIOR to VisibleDataSources, if applicable |
|
| 32 | + AdHocSettings.VisibleDataSources = new string[] {"DataSource1", "DataSource2"}; |
|
| 33 | + HttpContext.Current.Session["ReportingInitialized"] = true; |
|
| 34 | + } |
|
| 35 | +} |
|
| 36 | +``` |
|
| 37 | + |
|
| 38 | +###Global.asax (VB.NET) |
|
| 39 | + |
|
| 40 | +```visualbasic |
|
| 41 | +'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig |
|
| 42 | +Public Class CustomAdHocConfig |
|
| 43 | + Inherits Izenda.AdHoc.DatabaseAdHocConfig |
|
| 44 | + |
|
| 45 | + Shared Sub InitializeReporting() |
|
| 46 | + 'Check to see if we've already initialized |
|
| 47 | + If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then |
|
| 48 | + Return |
|
| 49 | + 'Initialize System |
|
| 50 | + AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE" |
|
| 51 | + AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE" |
|
| 52 | + Izenda.AdHoc.AdHocSettings.AdHocConfig = New CustomAdHocConfig() |
|
| 53 | + AdHocSettings.LazySpMetadataPulling = true 'The relevant setting -- must be set PRIOR to VisibleDataSources, if applicable |
|
| 54 | + AdHocSettings.VisibleDataSources = New String() {"Datasource1", "Datasource2"} |
|
| 55 | + HttpContext.Current.Session("ReortingInitialized") = True |
|
| 56 | + End Sub |
|
| 57 | +End Class |
|
| 58 | +``` |
|
| ... | ... | \ No newline at end of file |