Class RedisDataProvider
- Namespace
- combit.Reporting.DataProviders
- Assembly
- combit.ListLabel31.CrossPlatform.RedisDataProvider.dll
Provides a data provider implementation for Redis databases using the StackExchange.Redis library.
[Serializable]
public sealed class RedisDataProvider : IDataProvider, IDisposable, ISerializable
- Inheritance
-
RedisDataProvider
- Implements
- Inherited Members
Examples
The following example demonstrates how to use the RedisDataProvider to export a report to PDF:
// Create a RedisDataProvider with a connection string.
RedisDataProvider provider = new RedisDataProvider("localhost:6379");
// Optional: Register a filter for grouping hash tables.
provider.RegisteredHashTables.Add((key) =>
{
if (key.StartsWith("user:"))
return "Users";
return null;
});
// Create a ListLabel reporting engine instance and assign the provider as the data source.
using ListLabel listLabel = new ListLabel();
listLabel.DataSource = provider;
// Configure export settings to generate a PDF.
ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
// Export the report to PDF.
listLabel.Export(exportConfiguration);
Remarks
The RedisDataProvider class implements IDataProvider to enable access to Redis data structures. It supports Redis Lists, Sets, Sorted Sets, and Hash types, automatically creating tables for each key in the database. For Hash types, you can register custom filters using RegisteredHashTables to group related hashes into a single table. The provider connects using a multiplexer configuration string and scans all keys in the specified database.
Constructors
RedisDataProvider(string)
Creates a new StackExchange.Redis.RedisDatabase instance
public RedisDataProvider(string multiplexerConfiguration)
Parameters
multiplexerConfigurationstringThe string configuration for the multiplexer
Properties
RegisteredHashTables
Holds the user-registered HashTables and their filter. Return the tablename if your filter applies for the given string or null/String.Empty if it doesnt apply
public List<Func<string, string>> RegisteredHashTables { get; }
Property Value
Examples
provider.RegisteredHashTables.Add((s) =>
{
if (s.StartsWith("user"))
return "user";
return null;
});
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
~RedisDataProvider()
protected ~RedisDataProvider()