Guides/Izenda-AdHoc-Driver.md
... ...
@@ -117,8 +117,9 @@ Now you can add connections to the data sources end points. The end point could
117 117
You can use the standard SqlServerConnectionString to connect to your database directly and also use the FusionDriver's capabilities to connect to an indirect database connection (like OData) at the same time:
118 118
119 119
```csharp
120
-AdHocSettings.SqlServerConnectionString = "my_direct_connection_string";
121
-Izenda.Fusion.FusionDriver.AddODataConnection("OD", @"http://url_to_odata_connector.com/provider_endpoint.aspx");
120
+AdHocSettings.SqlServerConnectionString = "my_first_connection_string";
121
+Izenda.Fusion.FusionDriver.AddSqlConnection("SqlNW", @"my_second_connection_string");
122
+Izenda.Fusion.FusionDriver.AddODataConnection("OD", @"http://...aspx");
122 123
```
123 124
124 125
#####b) Adding multiple indirect data connections.
... ...
@@ -129,6 +130,7 @@ You can use the FusionDriver to add multiple indirect database connections to yo
129 130
//only for direct connections
130 131
//AdHocSettings.SqlServerConnectionString = "my_direct_connection_string";
131 132
Izenda.Fusion.FusionDriver fd = new Izenda.Fusion.FusionDriver();
133
+fd.AddConnection("SqlNW", Izenda.Fusion.FusionConnectionType.MsSql, @"http://url_to_sql_connector.com/provider_endpoint.aspx");
132 134
fd.AddConnection("OD", Izenda.Fusion.FusionConnectionType.OData, @"http://url_to_odata_connector.com/provider_endpoint.aspx");
133 135
fd.AddConnection("OD2", Izenda.Fusion.FusionConnectionType.OData, @"http://url_to_odata_2_connector.com/provider_endpoint.aspx");
134 136
AdHocSettings.AdHocContext.Driver = fd;
... ...
@@ -140,15 +142,19 @@ The Izenda Fusion Driver has several additional settings:
140 142
141 143
#####a) VisibleDataSources
142 144
143
-This is setup the same way as for a single connection. Only data sources with the specified names will be available:
145
+When using a FusionConnection with indirect database connections such as OData, the setup for VisibleDataSources is a little bit different. You will see an example below of setting up VisibleDataSources with indirect connections.
144 146
145 147
```csharp
146 148
AdHocSettings.VisibleDataSources = new string[] { "Orders", "Customers", "Order Details" };
149
+
150
+fusionDriver.FixVisibleDataSources();
147 151
```
148 152
153
+_**Note:** This does NOT apply to direct database connections. However, calling FixVisibleDataSources with direct database connections will not have any adverse effects on your VisibleDataSources._
154
+
149 155
#####b) Constraints
150 156
151
-This is setup the same as for single connection except that you are able to specify separate constraints for each connection by using connection aliases. Note that you can use wildcard characters to set up constraints:
157
+This is setup the same as for a single connection except that you are able to specify separate constraints for each connection by using connection aliases. Note that you can use wildcard characters to set up constraints:
152 158
153 159
**Example 1:** Static context
154 160
... ...
@@ -167,7 +173,7 @@ fd.AddConstraint("OD2/Account.Id", "OD2/User.AccountID");
167 173
168 174
#####c) Saving Reports with Fusion
169 175
170
-If you are using DatabaseAdHocConfig and reports are stored in the database, you need to explicitly specify the connection you will use for saving reports. The following example sets up the connection string to the database that contains the reports table. If you store reports in the file system then skip this step(use FileSystemAdHocConfig if you do this).
176
+When using indirect database connections and saving your reports to the FileSystem is not an option, you can use the SavedReportsDriver setting to specify a direct link to a database where you can store your reports. The following example sets up the connection string to the database that contains the reports table. If you store reports in the file system then skip this step(use FileSystemAdHocConfig if you do this).
171 177
172 178
```csharp
173 179
((DatabaseAdHocConfig)AdHocSettings.AdHocConfig).SavedReportsDriver = new MSSQLDriver("your_mssql_direct_database_connection_string");
... ...
@@ -180,11 +186,11 @@ Getting data from several data source providers may take a lot of time and resou
180 186
You can configure the cache yourself by using the following properties and methods:
181 187
182 188
* **DataCacheExpiration:** Sets the date for cache expiration. All data in the cache older than the specified date will be cleared (removed from the cache). For example, if you want to clear all data more than two days old, you should set: ``AdHocSettings.DataCacheExpiration = DateTime.Now.AddDays(-2);``
183
-* **CacheReports method:** Indicates that all reports should or should not be cached: ``fusionDriver.CacheReports = true;``
189
+* **CacheReports method:** Indicates that all reports should or should not be cached (enabled by default in later versions of Izenda): ``fusionDriver.CacheReports = true;``
184 190
185 191
###Sample use
186 192
187
-Below is a full example of how to set up and configure the Izenda Fusion Driver with several connections and reports stored in your database:
193
+Now that we have covered the basics of setting up the Fusion driver, below is a full example of how to set up and configure the Izenda Fusion Driver with several connections:
188 194
189 195
####SQL/Oracle/MySql data connection
190 196
... ...
@@ -231,10 +237,13 @@ public class CustomAdHocConfig : Izenda.AdHoc.DatabaseAdHocConfig //Izenda.AdHo
231 237
AdHocSettings.CacheReports = true;
232 238
233 239
// Set connection to the database with reports table
234
- ((DatabaseAdHocConfig)AdHocSettings.AdHocConfig).SavedReportsDriver = new MSSQLDriver("your_mssql_direct_database_connection_string");
240
+ ((DatabaseAdHocConfig)AdHocSettings.AdHocConfig).SavedReportsDriver = new MSSQLDriver(@"your_mssql_direct_database_connection_string");
235 241
236 242
// Add visible data sources
237 243
AdHocSettings.VisibleDataSources = new string[] { "Orders", "Customers", "Order Details" };
244
+
245
+ //clean up the DataSources
246
+ fusionDriver.FixVisibleDatasources();
238 247
}
239 248
}
240 249
</script>
... ...
@@ -254,7 +263,7 @@ The following example describes the process for initializing a FusionDriver conn
254 263
255 264
<script runat="server">
256 265
[Serializable]
257
-public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
266
+public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig //DatabaseAdHocConfig You can use either FileSystemAdHocConfig or DatabaseAdHocConfig because we set the SavedReportsDriver below
258 267
{
259 268
public static void InitializeReporting()
260 269
{
... ...
@@ -278,7 +287,7 @@ public class CustomAdHocConfig : Izenda.AdHoc.FileSystemAdHocConfig
278 287
// Clear cache
279 288
AdHocSettings.DataCacheExpiration = DateTime.Now;
280 289
281
- // Add some reports to the cache
290
+ // enable caching (on later versions of Izenda this is enabled by default)
282 291
AdHocContext.CacheReports = true;
283 292
284 293
// Set connection to the database with the reports table. You CANNOT use an OData connection as your SavedReportsDriver connection string
... ...
@@ -373,4 +382,12 @@ public override Column[] GetColumns(Izenda.AdHoc.Database.Table table) {
373 382
}
374 383
return cols;
375 384
}
385
+```
386
+
387
+###Implementing the Custom Fusion Driver
388
+
389
+You can then set the AdHocContext.Driver property to your CustomFusionDriver and you're done!
390
+
391
+```csharp
392
+AdHocContext.Driver = new CustomFusionDriver();
376 393
```
... ...
\ No newline at end of file