FAQ/Questions/MultipleConstraints.md
... ...
@@ -0,0 +1,88 @@
1
+#ConnectionStringRW
2
+[[_TOC_]]
3
+
4
+
5
+##About
6
+
7
+ConnectionStringRW is one of the Izenda Driver's properties, which enables users to have Read-Write access permission to Database.
8
+Below is a sample global.asax using the ConnectionStringRW setting. The code block will appear within <script runat="server"> </script> tags within global.asax
9
+
10
+##Global.asax (C♯)
11
+```csharp
12
+
13
+ public class CustomAdHocConfig : FileSystemAdHocConfig {
14
+ public static void InitializeReporting() {
15
+ //Check to see if we've already initialized.
16
+ if (HttpContext.Current.Session == null || HttpContext.Current.Session["ReportingInitialized"] != null)
17
+ return;
18
+ //Initialize System
19
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE";
20
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE";
21
+ AdHocContext.Driver.ConnectionStringRW = "INSERT_CONNECTION_STRING_HERE"; // ConnectionStringRW was used
22
+ ...
23
+ }
24
+}
25
+```
26
+
27
+##Global.asax (VB.NET)
28
+
29
+```visualbasic
30
+
31
+'main class: inherits DatabaseAdHocConfig or FileSystemAdHocConfig
32
+Public Class CustomAdHocConfig
33
+ Inherits Izenda.AdHoc.DatabaseAdHocConfig
34
+
35
+ Shared Sub InitializeReporting()
36
+ 'Check to see if we've already initialized
37
+ If HttpContext.Current.Session Is Nothing OrElse HttpContext.Current.Session("ReportingInitialized") IsNot Nothing Then
38
+ Return
39
+ 'Initialize System
40
+ AdHocSettings.LicenseKey = "INSERT_LICENSE_KEY_HERE"
41
+ AdHocSettings.SqlServerConnectionString = "INSERT_CONNECTION_STRING_HERE"
42
+ AdHocContext.Driver.ConnectionStringRW = "INSERT_CONNECTION_STRING_HERE"
43
+
44
+
45
+ End Sub
46
+
47
+End Class
48
+```
49
+
50
+Though ConnectionStringRW doesn't require Fusion, if you want to use Fusion together with ConnectionStringRW, read-only connection strings should be used everywhere in Fusion/DB initialization, and assign read/write connection string here:
51
+
52
+```csharp
53
+FusionDriver fd = new FusionDriver();
54
+ fd.AddConnection("_alias_", FusionConnectionType.MsSql, "_read_only_connection_string_");
55
+ AdHocContext.Driver = fd;
56
+ AdHocSettings.AdHocConfig = new CustomAdHocConfig();
57
+ ((DatabaseAdHocConfig) AdHocSettings.AdHocConfig).SavedReportsDriver = new MSSQLDriver("_read_only_connection_string_");
58
+ ((DatabaseAdHocConfig) AdHocSettings.AdHocConfig).SavedReportsDriver.ConnectionStringRW = "_read/write_connection_string_";
59
+```
60
+
61
+##How ConnectionStringRW works
62
+
63
+1) If ConnectionStringRW is not assigned, Izenda uses Driver.ConnectionString for all operations against DB
64
+
65
+2) If ConnectionStringRW is also assigned, then Izenda will
66
+
67
+ ---a) Use Driver.ConnectionString for Read-Only operations against DB, thus Driver.ConnectionString can have ReadOnly access to the DB
68
+
69
+ ---b) Use Driver.ConnectionStringRW for Read-Write operations. At this moment this includes only following:
70
+
71
+ - Create Reports table if it doesn't exist
72
+
73
+ - Create/Update/Delete Thumbnails in Reports table in Database mode
74
+
75
+ - Create/Update/Delete Forms in Reports table in Database mode
76
+
77
+ - Create/Save/Delete ReportSets in Reports table in Database mode
78
+
79
+
80
+[Here](http://www.screencast.com/users/IzendaReports/folders/Temporary/media/9a2e633c-bbc7-4c47-9425-8df36d36e368) is the video explaining how to create ReadOnly connection string in MSSQL
81
+
82
+[Here](http://www.screencast.com/users/IzendaReports/folders/Temporary/media/a04a117c-89d1-40f3-8053-55d0d7586d1a) is video demonstrating how installation works when Driver.ConnectionStringRW is assigned for read-write operations, and Driver.ConnectionString has ReadOnly access:
83
+
84
+##Usage
85
+ConnectionStringRW can be used always. General case is just safety improvement - if user specifies ConnectionStringRW, and uses read-only DB account for usual Driver.ConnectionString - he can be 100% sure that users will not be able to modify anything in DB by any means - like using SQL injections. Just because everything which user can input - goes to DB via read-only connection string.
86
+
87
+##
88
+