diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/AssemblyInitializer.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/AssemblyInitializer.cs
new file mode 100644
index 00000000..d1f54edd
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/AssemblyInitializer.cs
@@ -0,0 +1,13 @@
+using FastReport.Utils;
+
+
+namespace FastReport.Data
+{
+ public class CouchbaseAssemblyInitializer : AssemblyInitializerBase
+ {
+ public CouchbaseAssemblyInitializer()
+ {
+ RegisteredObjects.AddConnection(typeof(CouchbaseDataConnection));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.Designer.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.Designer.cs
new file mode 100644
index 00000000..dd5578bf
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.Designer.cs
@@ -0,0 +1,175 @@
+namespace FastReport.Data
+{
+ partial class CouchbaseConnectionEditor
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.gbDatabase = new System.Windows.Forms.GroupBox();
+ this.tbDatabase = new System.Windows.Forms.TextBox();
+ this.lblDatabase = new System.Windows.Forms.Label();
+ this.tbPassword = new System.Windows.Forms.TextBox();
+ this.lblUserName = new System.Windows.Forms.Label();
+ this.tbUserName = new System.Windows.Forms.TextBox();
+ this.lblPassword = new System.Windows.Forms.Label();
+ this.gbServer = new System.Windows.Forms.GroupBox();
+ this.tbHost = new System.Windows.Forms.TextBox();
+ this.lblHost = new System.Windows.Forms.Label();
+ this.labelLine1 = new FastReport.Controls.LabelLine();
+ this.gbDatabase.SuspendLayout();
+ this.gbServer.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // gbDatabase
+ //
+ this.gbDatabase.Controls.Add(this.tbDatabase);
+ this.gbDatabase.Controls.Add(this.lblDatabase);
+ this.gbDatabase.Location = new System.Drawing.Point(15, 12);
+ this.gbDatabase.Name = "gbDatabase";
+ this.gbDatabase.Size = new System.Drawing.Size(308, 66);
+ this.gbDatabase.TabIndex = 0;
+ this.gbDatabase.TabStop = false;
+ this.gbDatabase.Text = "Database";
+ //
+ // tbDatabase
+ //
+ this.tbDatabase.Location = new System.Drawing.Point(6, 33);
+ this.tbDatabase.Name = "tbDatabase";
+ this.tbDatabase.Size = new System.Drawing.Size(296, 20);
+ this.tbDatabase.TabIndex = 0;
+ //
+ // lblDatabase
+ //
+ this.lblDatabase.AutoSize = true;
+ this.lblDatabase.Location = new System.Drawing.Point(6, 17);
+ this.lblDatabase.Name = "lblDatabase";
+ this.lblDatabase.Size = new System.Drawing.Size(86, 13);
+ this.lblDatabase.TabIndex = 0;
+ this.lblDatabase.Text = "Database name:";
+ //
+ // tbPassword
+ //
+ this.tbPassword.Location = new System.Drawing.Point(114, 93);
+ this.tbPassword.Name = "tbPassword";
+ this.tbPassword.Size = new System.Drawing.Size(188, 20);
+ this.tbPassword.TabIndex = 2;
+ this.tbPassword.UseSystemPasswordChar = true;
+ //
+ // lblUserName
+ //
+ this.lblUserName.AutoSize = true;
+ this.lblUserName.Location = new System.Drawing.Point(6, 70);
+ this.lblUserName.Name = "lblUserName";
+ this.lblUserName.Size = new System.Drawing.Size(62, 13);
+ this.lblUserName.TabIndex = 0;
+ this.lblUserName.Text = "User name:";
+ //
+ // tbUserName
+ //
+ this.tbUserName.Location = new System.Drawing.Point(114, 67);
+ this.tbUserName.Name = "tbUserName";
+ this.tbUserName.Size = new System.Drawing.Size(188, 20);
+ this.tbUserName.TabIndex = 1;
+ //
+ // lblPassword
+ //
+ this.lblPassword.AutoSize = true;
+ this.lblPassword.Location = new System.Drawing.Point(6, 96);
+ this.lblPassword.Name = "lblPassword";
+ this.lblPassword.Size = new System.Drawing.Size(57, 13);
+ this.lblPassword.TabIndex = 0;
+ this.lblPassword.Text = "Password:";
+ //
+ // gbServer
+ //
+ this.gbServer.Controls.Add(this.tbHost);
+ this.gbServer.Controls.Add(this.lblHost);
+ this.gbServer.Controls.Add(this.tbPassword);
+ this.gbServer.Controls.Add(this.lblUserName);
+ this.gbServer.Controls.Add(this.tbUserName);
+ this.gbServer.Controls.Add(this.lblPassword);
+ this.gbServer.Location = new System.Drawing.Point(15, 84);
+ this.gbServer.Name = "gbServer";
+ this.gbServer.Size = new System.Drawing.Size(308, 126);
+ this.gbServer.TabIndex = 1;
+ this.gbServer.TabStop = false;
+ this.gbServer.Text = "Server";
+ //
+ // tbHost
+ //
+ this.tbHost.Location = new System.Drawing.Point(9, 41);
+ this.tbHost.Name = "tbHost";
+ this.tbHost.Size = new System.Drawing.Size(293, 20);
+ this.tbHost.TabIndex = 0;
+ //
+ // lblHost
+ //
+ this.lblHost.AutoSize = true;
+ this.lblHost.Location = new System.Drawing.Point(6, 25);
+ this.lblHost.Name = "lblHost";
+ this.lblHost.Size = new System.Drawing.Size(33, 13);
+ this.lblHost.TabIndex = 0;
+ this.lblHost.Text = "Host:";
+ //
+ // labelLine1
+ //
+ this.labelLine1.Location = new System.Drawing.Point(15, 216);
+ this.labelLine1.Name = "labelLine1";
+ this.labelLine1.Size = new System.Drawing.Size(308, 16);
+ this.labelLine1.TabIndex = 0;
+ //
+ // CouchbaseConnectionEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.gbDatabase);
+ this.Controls.Add(this.gbServer);
+ this.Controls.Add(this.labelLine1);
+ this.Name = "CouchbaseConnectionEditor";
+ this.Size = new System.Drawing.Size(336, 237);
+ this.gbDatabase.ResumeLayout(false);
+ this.gbDatabase.PerformLayout();
+ this.gbServer.ResumeLayout(false);
+ this.gbServer.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.GroupBox gbDatabase;
+ private System.Windows.Forms.TextBox tbDatabase;
+ private System.Windows.Forms.Label lblDatabase;
+ private System.Windows.Forms.TextBox tbPassword;
+ private System.Windows.Forms.Label lblUserName;
+ private System.Windows.Forms.TextBox tbUserName;
+ private System.Windows.Forms.Label lblPassword;
+ private System.Windows.Forms.GroupBox gbServer;
+ private System.Windows.Forms.TextBox tbHost;
+ private System.Windows.Forms.Label lblHost;
+ private Controls.LabelLine labelLine1;
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.cs
new file mode 100644
index 00000000..009e88b8
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.cs
@@ -0,0 +1,72 @@
+using FastReport.Utils;
+using FastReport.Data.ConnectionEditors;
+
+namespace FastReport.Data
+{
+ ///
+ /// Represents a Couchbase connection editor.
+ ///
+ public partial class CouchbaseConnectionEditor : ConnectionEditorBase
+ {
+ #region Fields
+
+ private string FConnectionString;
+
+ #endregion Fields
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CouchbaseConnectionEditor()
+ {
+ InitializeComponent();
+ Localize();
+ }
+
+ #endregion Constructors
+
+ #region Private Methods
+
+ private void Localize()
+ {
+ MyRes res = new MyRes("ConnectionEditors,Common");
+ gbServer.Text = res.Get("ServerLogon");
+ lblUserName.Text = res.Get("UserName");
+ lblPassword.Text = res.Get("Password");
+ gbDatabase.Text = res.Get("Database");
+ lblDatabase.Text = res.Get("DatabaseName");
+
+ res = new MyRes("Export,Email");
+ }
+
+ #endregion Private Methods
+
+ #region Protected Methods
+
+ ///
+ protected override string GetConnectionString()
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder();
+ builder.DatabaseName = tbDatabase.Text;
+ builder.Host = tbHost.Text;
+ builder.Username = tbUserName.Text;
+ builder.Password = tbPassword.Text;
+ return builder.ToString();
+ }
+
+ ///
+ protected override void SetConnectionString(string value)
+ {
+ FConnectionString = value;
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(value);
+ tbDatabase.Text = builder.DatabaseName;
+ tbHost.Text = builder.Host;
+ tbUserName.Text = builder.Username;
+ tbPassword.Text = builder.Password;
+ }
+
+ #endregion Protected Methods
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.resx b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.resx
new file mode 100644
index 00000000..1af7de15
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionEditor.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionStringBuilder.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionStringBuilder.cs
new file mode 100644
index 00000000..f8dfb6cf
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseConnectionStringBuilder.cs
@@ -0,0 +1,133 @@
+using System;
+using System.Text;
+
+namespace FastReport.Data
+{
+ ///
+ /// Represents the CouchbaseDataConnection connection string builder.
+ ///
+ ///
+ /// Use this class to parse connection string returned by the CouchbaseDataConnection class.
+ ///
+ public class CouchbaseConnectionStringBuilder
+ {
+ #region Fields
+
+ private string databaseName;
+ private string host;
+ private string username;
+ private string password;
+ private string connectionString;
+
+ #endregion Fields
+
+ #region Properties
+
+ ///
+ /// Gets or sets the host.
+ ///
+ public string Host
+ {
+ get { return host; }
+ set { host = value; }
+ }
+
+ ///
+ /// Gets or sets the username.
+ ///
+ public string Username
+ {
+ get { return username; }
+ set { username = value; }
+ }
+
+ ///
+ /// Gets or sets the password.
+ ///
+ public string Password
+ {
+ get { return password; }
+ set { password = value; }
+ }
+
+ ///
+ /// Gets or sets the database name.
+ ///
+ public string DatabaseName
+ {
+ get { return databaseName; }
+ set { databaseName = value; }
+ }
+
+ #endregion Properties
+
+ #region Constructors
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ public CouchbaseConnectionStringBuilder()
+ {
+ connectionString = "";
+ host = "";
+ databaseName = "";
+ username = "";
+ password = "";
+ }
+
+ ///
+ /// Initializes a new instance of the class with a specified connection string.
+ ///
+ /// The connection string value.
+ public CouchbaseConnectionStringBuilder(string connectionString)
+ {
+ this.connectionString = connectionString;
+ string[] parts = connectionString.Split(';');
+ if (parts[0].Contains("Url"))
+ {
+ host = parts[0].Replace("Url = ", "");
+ }
+ for (int i = 1; i < parts.Length; i++)
+ {
+ if (parts[i].Contains("Database"))
+ {
+ databaseName = parts[i].Replace("Database=", "");
+ }
+ if (parts[i].Contains("User"))
+ {
+ username = parts[i].Replace("User=", "");
+ }
+ if (parts[i].Contains("Password"))
+ {
+ password = parts[i].Replace("Password=", "");
+ }
+ }
+ }
+
+ #endregion Constructors
+
+ #region Public Methods
+
+ ///
+ public override string ToString()
+ {
+ StringBuilder sb = new StringBuilder("Url = ");
+ sb.Append(host);
+ if (!String.IsNullOrEmpty(databaseName))
+ {
+ sb.AppendFormat(";Database={0}", databaseName);
+ }
+ if (!String.IsNullOrEmpty(username))
+ {
+ sb.AppendFormat(";User={0}", username);
+ }
+ if (!String.IsNullOrEmpty(password))
+ {
+ sb.AppendFormat(";Password={0}", password);
+ }
+ return sb.ToString();
+ }
+
+ #endregion Public Methods
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.DesignExt.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.DesignExt.cs
new file mode 100644
index 00000000..5402db12
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.DesignExt.cs
@@ -0,0 +1,30 @@
+using System;
+using FastReport.Data.ConnectionEditors;
+
+namespace FastReport.Data
+{
+ ///
+ /// Represents a connection to Couchbase database.
+ ///
+ public partial class CouchbaseDataConnection
+ {
+ ///
+ public override Type GetConnectionType()
+ {
+ return typeof(CouchbaseDataConnection);
+ }
+
+ ///
+ public override string GetConnectionId()
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ return "Couchbase: " + builder.ToString();
+ }
+
+ ///
+ public override ConnectionEditorBase GetEditor()
+ {
+ return new CouchbaseConnectionEditor();
+ }
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.cs b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.cs
new file mode 100644
index 00000000..77ccfd81
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/CouchbaseDataConnection.cs
@@ -0,0 +1,144 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.ComponentModel;
+using Couchbase;
+using Couchbase.Configuration.Client;
+using Couchbase.Authentication;
+using Newtonsoft.Json.Linq;
+using System.Text;
+
+namespace FastReport.Data
+{
+ ///
+ /// Represents a connection to Couchbase database.
+ ///
+ public partial class CouchbaseDataConnection : JsonDataConnection
+ {
+ #region Properties
+
+ ///
+ /// Gets or sets the database name.
+ ///
+ [Category("Data")]
+ public string DatabaseName
+ {
+ get
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ return builder.DatabaseName;
+ }
+ set
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ builder.DatabaseName = value;
+ ConnectionString = builder.ToString();
+ }
+ }
+
+ ///
+ /// Gets or sets the host url.
+ ///
+ [Category("Data")]
+ public string Host
+ {
+ get
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ return builder.Host;
+ }
+ set
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ builder.Host = value;
+ ConnectionString = builder.ToString();
+ }
+ }
+
+ ///
+ /// Gets or sets the username.
+ ///
+ [Category("Data")]
+ public string Username
+ {
+ get
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ return builder.Username;
+ }
+ set
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ builder.Username = value;
+ ConnectionString = builder.ToString();
+ }
+ }
+
+ ///
+ /// Gets or sets the password.
+ ///
+ [Category("Data")]
+ public string Password
+ {
+ get
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ return builder.Password;
+ }
+ set
+ {
+ CouchbaseConnectionStringBuilder builder = new CouchbaseConnectionStringBuilder(ConnectionString);
+ builder.Password = value;
+ ConnectionString = builder.ToString();
+ }
+ }
+
+ #endregion Properties
+
+ #region Protected Methods
+
+ ///
+ protected override DataSet CreateDataSet()
+ {
+ using (var cluster = new Cluster(new ClientConfiguration
+ {
+ Servers = new List { new Uri(Host) }
+ }))
+ {
+ var authenticator = new PasswordAuthenticator(Username, Password);
+ cluster.Authenticate(authenticator);
+ var bucket = cluster.OpenBucket(DatabaseName);
+ List entityNames = cluster.Query("select distinct `type` from `beer-sample`")
+ .Rows.Select(v => v.GetValue("type").ToString()).ToList();
+
+ StringBuilder json = new StringBuilder();
+ json.Append("{\n");
+ foreach (string name in entityNames)
+ {
+ json.Append("\"").Append(name).Append("\":\n[");
+ DataTable table = new DataTable(name);
+
+ // get all rows of the table
+ var objects = cluster.Query($"select * from `{DatabaseName}` where type = \"{name}\"")
+ .Rows.ToList();
+ foreach (var jobj in objects)
+ {
+ json.Append(jobj.GetValue(DatabaseName).ToString());
+ if (jobj != objects.Last())
+ json.Append(",");
+ }
+ json.Append("]\n");
+ if (name != entityNames.Last())
+ json.Append(",");
+ }
+ json.Append("}");
+ var jsstring = json.ToString();
+ JsonData = jsstring;
+ return base.CreateDataSet();
+ }
+ }
+
+ #endregion Protected Methods
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/FastReport.Data.Couchbase.csproj b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/FastReport.Data.Couchbase.csproj
new file mode 100644
index 00000000..5ef9632a
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/FastReport.Data.Couchbase.csproj
@@ -0,0 +1,96 @@
+
+
+
+ netstandard2.0;net4.5
+ ../../../FastReport.Plugins.snk
+ true
+ Fast Reports Inc.
+ Fast Reports Inc.
+ https://www.fast-report.com/en/product/fast-report-net/license
+ https://www.fast-report.com/en/product/fast-report-net
+ Fast Reports Inc.
+ FastReport.Data.Couchbase
+ Represents a connection to Couchbase server for FastReport.Net.
+ FastReport.Data.Couchbase
+ https://www.fast-report.com/download/images/frlogo-big.png
+ reporting, Couchbase, connection, reports
+ 2018.2.2$(VersionSuffix)
+ 2018.2.2.0
+ 2018.2.2.0
+ Debug;Release;
+ FastReport.Data.Couchbase
+ FastReport.Data
+
+
+
+ FRCORE;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ False
+ ..\..\..\..\FastReport\bin\Release\FastReport.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ CouchbaseConnectionEditor.cs
+
+
+
+
+ CouchbaseConnectionEditor.cs
+ Designer
+
+
+
+
\ No newline at end of file
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/readme.txt b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/readme.txt
new file mode 100644
index 00000000..eb47e4cf
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Couchbase/readme.txt
@@ -0,0 +1,14 @@
+How to use it:
+- execute the following code once at the application start:
+FastReport.Utils.RegisteredObjects.AddConnection(typeof(CouchbaseDataConnection));
+- now you should be able to create a new Couchbase data source from Designer (.Net 4) or from code:
+Report report = new Report();
+report.Load(@"YourReport.frx");
+//...
+CouchbaseDataConnection con = new CouchbaseDataConnection();
+con.Host = "http://127.0.0.1:8091";
+con.DatabaseName = "beer-sample";
+con.Username = "username";
+con.Password = "userPass";
+conn.CreateAllTables();
+report.Dictionary.Connections.Add(conn);
\ No newline at end of file
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Json/AssemblyInitializer.cs b/Extras/Core/FastReport.Data/FastReport.Data.Json/AssemblyInitializer.cs
new file mode 100644
index 00000000..5f70a795
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Json/AssemblyInitializer.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using FastReport.Utils;
+
+namespace FastReport.Data
+{
+ public class JsonAssemblyInitializer : AssemblyInitializerBase
+ {
+ public JsonAssemblyInitializer()
+ {
+ RegisteredObjects.AddConnection(typeof(JsonDataConnection));
+ }
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Json/FastReport.Data.Json.csproj b/Extras/Core/FastReport.Data/FastReport.Data.Json/FastReport.Data.Json.csproj
new file mode 100644
index 00000000..ed6aa733
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Json/FastReport.Data.Json.csproj
@@ -0,0 +1,93 @@
+
+
+
+ netstandard2.0;net4;net4.5
+ true
+ ../../../FastReport.Plugins.snk
+ true
+ Fast Reports Inc.
+ Fast Reports Inc.
+ https://www.fast-report.com/en/product/fast-report-net/license
+ https://www.fast-report.com/en/product/fast-report-net
+ Fast Reports Inc.
+ FastReport.Data.Json
+ Represents a connection to Json data for FastReport.Net.
+ FastReport.Data.Json
+ https://www.fast-report.com/download/images/frlogo-big.png
+ reporting, Json, connection, reports
+ 2018.3.11$(VersionSuffix)
+ 2018.3.11.0
+ 2018.3.11.0
+ Debug;Release;
+ FastReport.Data.Json
+ FastReport.Data
+ Fixed bug with Newtonsoft.Json.dll location
+
+
+ FRCORE;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ false
+
+
+ False
+ ..\..\..\..\FastReport\bin\Release\FastReport.dll
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ JsonConnectionEditor.cs
+
+
+
+
+ JsonConnectionEditor.cs
+ Designer
+
+
+
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/CSharpCodeWriter.cs b/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/CSharpCodeWriter.cs
new file mode 100644
index 00000000..c8e56206
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/CSharpCodeWriter.cs
@@ -0,0 +1,304 @@
+// Copyright © 2010 Xamasoft
+// Licensed under the Microsoft Reciprocal License (MS-RL). See LICENSE.txt for license information.
+
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+
+namespace FastReport.JsonClassGenerator
+{
+ public class CSharpCodeWriter : ICodeWriter
+ {
+ public string FileExtension
+ {
+ get { return ".cs"; }
+ }
+
+ public string DisplayName
+ {
+ get { return "C#"; }
+ }
+
+
+ private const string NoRenameAttribute = "[Obfuscation(Feature = \"renaming\", Exclude = true)]";
+ private const string NoPruneAttribute = "[Obfuscation(Feature = \"trigger\", Exclude = false)]";
+
+ public string GetTypeName(JsonType type, IJsonClassGeneratorConfig config)
+ {
+ var arraysAsLists = !config.ExplicitDeserialization;
+
+ switch (type.Type)
+ {
+ case JsonTypeEnum.Anything: return "object";
+ case JsonTypeEnum.Array: return arraysAsLists ? "IList<" + GetTypeName(type.InternalType, config) + ">" : GetTypeName(type.InternalType, config) + "[]";
+ case JsonTypeEnum.Dictionary: return "Dictionary";
+ case JsonTypeEnum.Boolean: return "bool";
+ case JsonTypeEnum.Float: return "double";
+ case JsonTypeEnum.Integer: return "int";
+ case JsonTypeEnum.Long: return "long";
+ case JsonTypeEnum.Date: return "DateTime";
+ case JsonTypeEnum.NonConstrained: return "object";
+ case JsonTypeEnum.NullableBoolean: return "bool?";
+ case JsonTypeEnum.NullableFloat: return "double?";
+ case JsonTypeEnum.NullableInteger: return "int?";
+ case JsonTypeEnum.NullableLong: return "long?";
+ case JsonTypeEnum.NullableDate: return "DateTime?";
+ case JsonTypeEnum.NullableSomething: return "object";
+ case JsonTypeEnum.Object: return type.AssignedName;
+ case JsonTypeEnum.String: return "string";
+ default: throw new System.NotSupportedException("Unsupported json type");
+ }
+ }
+
+
+ private bool ShouldApplyNoRenamingAttribute(IJsonClassGeneratorConfig config)
+ {
+ return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && !config.UsePascalCase;
+ }
+ private bool ShouldApplyNoPruneAttribute(IJsonClassGeneratorConfig config)
+ {
+ return config.ApplyObfuscationAttributes && !config.ExplicitDeserialization && config.UseProperties;
+ }
+
+ public void WriteFileStart(IJsonClassGeneratorConfig config, TextWriter sw)
+ {
+ if (config.UseNamespaces)
+ {
+ //XXX
+ //foreach (var line in JsonClassGenerator.FileHeader)
+ //{
+ // sw.WriteLine("// " + line);
+ //}
+ //sw.WriteLine();
+ sw.WriteLine("using System;");
+ sw.WriteLine("using System.Collections.Generic;");
+ if (ShouldApplyNoPruneAttribute(config) || ShouldApplyNoRenamingAttribute(config))
+ sw.WriteLine("using System.Reflection;");
+ if (!config.ExplicitDeserialization && config.UsePascalCase)
+ sw.WriteLine("using Newtonsoft.Json;");
+ //sw.WriteLine("using Newtonsoft.Json.Linq;");
+ if (config.ExplicitDeserialization)
+ sw.WriteLine("using JsonCSharpClassGenerator;");
+ if (config.SecondaryNamespace != null && config.HasSecondaryClasses && !config.UseNestedClasses)
+ {
+ sw.WriteLine("using {0};", config.SecondaryNamespace);
+ }
+ }
+
+ if (config.UseNestedClasses)
+ {
+ sw.WriteLine(" {0} class {1}", config.InternalVisibility ? "internal" : "public", config.MainClass);
+ sw.WriteLine(" {");
+ }
+ }
+
+ public void WriteFileEnd(IJsonClassGeneratorConfig config, TextWriter sw)
+ {
+ if (config.UseNestedClasses)
+ {
+ sw.WriteLine(" }");
+ }
+ }
+
+
+ public void WriteNamespaceStart(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
+ {
+ sw.WriteLine();
+ sw.WriteLine("namespace {0}", root && !config.UseNestedClasses ? config.Namespace : (config.SecondaryNamespace ?? config.Namespace));
+ sw.WriteLine("{");
+ sw.WriteLine();
+ }
+
+ public void WriteNamespaceEnd(IJsonClassGeneratorConfig config, TextWriter sw, bool root)
+ {
+ sw.WriteLine("}");
+ }
+
+ public void WriteClass(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type)
+ {
+ var visibility = config.InternalVisibility ? "internal" : "public";
+
+
+
+ if (config.UseNestedClasses)
+ {
+ if (!type.IsRoot)
+ {
+ if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
+ if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
+ sw.WriteLine(" {0} class {1}", visibility, type.AssignedName);
+ sw.WriteLine(" {");
+ }
+ }
+ else
+ {
+ if (ShouldApplyNoRenamingAttribute(config)) sw.WriteLine(" " + NoRenameAttribute);
+ if (ShouldApplyNoPruneAttribute(config)) sw.WriteLine(" " + NoPruneAttribute);
+ sw.WriteLine(" {0} class {1}", visibility, type.AssignedName);
+ sw.WriteLine(" {");
+ }
+
+ var prefix = config.UseNestedClasses && !type.IsRoot ? " " : " ";
+
+
+ var shouldSuppressWarning = config.InternalVisibility && !config.UseProperties && !config.ExplicitDeserialization;
+ if (shouldSuppressWarning)
+ {
+ sw.WriteLine("#pragma warning disable 0649");
+ if (!config.UsePascalCase) sw.WriteLine();
+ }
+
+ if (type.IsRoot && config.ExplicitDeserialization) WriteStringConstructorExplicitDeserialization(config, sw, type, prefix);
+
+ if (config.ExplicitDeserialization)
+ {
+ if (config.UseProperties) WriteClassWithPropertiesExplicitDeserialization(sw, type, prefix);
+ else WriteClassWithFieldsExplicitDeserialization(sw, type, prefix);
+ }
+ else
+ {
+ WriteClassMembers(config, sw, type, prefix);
+ }
+
+ if (shouldSuppressWarning)
+ {
+ sw.WriteLine();
+ sw.WriteLine("#pragma warning restore 0649");
+ sw.WriteLine();
+ }
+
+
+ if (config.UseNestedClasses && !type.IsRoot)
+ sw.WriteLine(" }");
+
+ if (!config.UseNestedClasses)
+ sw.WriteLine(" }");
+
+ sw.WriteLine();
+
+
+ }
+
+
+
+ private void WriteClassMembers(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
+ {
+ foreach (var field in type.Fields)
+ {
+ if (config.UsePascalCase || config.ExamplesInDocumentation) sw.WriteLine();
+
+ if (config.ExamplesInDocumentation)
+ {
+ sw.WriteLine(prefix + "/// ");
+ sw.WriteLine(prefix + "/// Examples: " + field.GetExamplesText());
+ sw.WriteLine(prefix + "/// ");
+ }
+
+ if (config.UsePascalCase)
+ {
+
+ sw.WriteLine(prefix + "[JsonProperty(\"{0}\")]", field.JsonMemberName);
+ }
+
+ if (config.UseProperties)
+ {
+ sw.WriteLine(prefix + "public {0} {1} {{ get; set; }}", field.Type.GetTypeName(), field.MemberName);
+ }
+ else
+ {
+ sw.WriteLine(prefix + "public {0} {1};", field.Type.GetTypeName(), field.MemberName);
+ }
+ }
+
+ }
+
+
+
+
+
+
+
+ #region Code for (obsolete) explicit deserialization
+ private void WriteClassWithPropertiesExplicitDeserialization(TextWriter sw, JsonType type, string prefix)
+ {
+
+ sw.WriteLine(prefix + "private JObject __jobject;");
+ sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName);
+ sw.WriteLine(prefix + "{");
+ sw.WriteLine(prefix + " this.__jobject = obj;");
+ sw.WriteLine(prefix + "}");
+ sw.WriteLine();
+
+ foreach (var field in type.Fields)
+ {
+
+ string variable = null;
+ if (field.Type.MustCache)
+ {
+ variable = "_" + char.ToLower(field.MemberName[0]) + field.MemberName.Substring(1);
+ sw.WriteLine(prefix + "[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]");
+ sw.WriteLine(prefix + "private {0} {1};", field.Type.GetTypeName(), variable);
+ }
+
+
+ sw.WriteLine(prefix + "public {0} {1}", field.Type.GetTypeName(), field.MemberName);
+ sw.WriteLine(prefix + "{");
+ sw.WriteLine(prefix + " get");
+ sw.WriteLine(prefix + " {");
+ if (field.Type.MustCache)
+ {
+ sw.WriteLine(prefix + " if ({0} == null)", variable);
+ sw.WriteLine(prefix + " {0} = {1};", variable, field.GetGenerationCode("__jobject"));
+ sw.WriteLine(prefix + " return {0};", variable);
+ }
+ else
+ {
+ sw.WriteLine(prefix + " return {0};", field.GetGenerationCode("__jobject"));
+ }
+ sw.WriteLine(prefix + " }");
+ sw.WriteLine(prefix + "}");
+ sw.WriteLine();
+
+ }
+
+ }
+
+
+ private void WriteStringConstructorExplicitDeserialization(IJsonClassGeneratorConfig config, TextWriter sw, JsonType type, string prefix)
+ {
+ sw.WriteLine();
+ sw.WriteLine(prefix + "public {1}(string json)", config.InternalVisibility ? "internal" : "public", type.AssignedName);
+ sw.WriteLine(prefix + " : this(JObject.Parse(json))");
+ sw.WriteLine(prefix + "{");
+ sw.WriteLine(prefix + "}");
+ sw.WriteLine();
+ }
+
+ private void WriteClassWithFieldsExplicitDeserialization(TextWriter sw, JsonType type, string prefix)
+ {
+
+
+ sw.WriteLine(prefix + "public {0}(JObject obj)", type.AssignedName);
+ sw.WriteLine(prefix + "{");
+
+ foreach (var field in type.Fields)
+ {
+ sw.WriteLine(prefix + " this.{0} = {1};", field.MemberName, field.GetGenerationCode("obj"));
+
+ }
+
+ sw.WriteLine(prefix + "}");
+ sw.WriteLine();
+
+ foreach (var field in type.Fields)
+ {
+ sw.WriteLine(prefix + "public readonly {0} {1};", field.Type.GetTypeName(), field.MemberName);
+ }
+ }
+ #endregion
+
+ }
+}
diff --git a/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/FieldInfo.cs b/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/FieldInfo.cs
new file mode 100644
index 00000000..da206279
--- /dev/null
+++ b/Extras/Core/FastReport.Data/FastReport.Data.Json/JsonClassGenerator/FieldInfo.cs
@@ -0,0 +1,76 @@
+// Copyright © 2010 Xamasoft
+// Licensed under the Microsoft Reciprocal License (MS-RL). See LICENSE.txt for license information.
+
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace FastReport.JsonClassGenerator
+{
+ public class FieldInfo
+ {
+
+ public FieldInfo(IJsonClassGeneratorConfig generator, string jsonMemberName, JsonType type, bool usePascalCase, IList