This blog explores the new Aerospike driver for LINQPad and its available features. Aerospike for LINQPad 7 is a data context dynamic driver for interactively querying and updating an Aerospike database using "LINQPad". LINQPad is a Graphical Development Tool designed for rapid prototyping, data modeling, data mining, drag-and-drop execution, interactive debugging/testing, quickly learn new frameworks/APIs (e.g., Aerospike API ), etc. The Aerospike driver for LINQPad is designed to support all LINQPad features.
Here is a subset of what you can perform using the driver:
Query any Aerospike Set or Secondary Index using any LINQ command (including joins), interactively.
Use the driver’s extension methods to perform operations like Aerospike Expression , CRUD operations, etc. without understanding the underlying Aerospike API.
Serialize and deserialize any C# object via the Object-Mapper (POCO). The driver supports all C# data types, nested classes, and collections.
Full JSON support using Json.NET.
Execute UDFs directly and display their underlying code. UDFs are treated like C# methods with intellisense and code completion.
Export or import sets directly or with an Aerospike Filter .
Provides metadata about the cluster, including active/inactive nodes, Aerospike server version, etc.
Use the Aerospike API directly to perform advance operations or instantly test snippets used in your application code.
The driver can, also, dynamically detect the structure of records within an Aerospike Set resulting in an easy-to-understand view much like a relational table with enhanced capabilities. Some of these capabilities are:
detection of Bins with the same name but have different data types between records within a Set
records with different Bin structures within a Set
implicit data type conversion without the need to cast or check a Bin's data type for quick data operations
enhanced Aerospike CDT handling
driver extension methods to programmatically interrogate Namespaces, Sets, records, Bins, Bin data types, etc.
The screenshot below show how Aerospike Sets and Bins are represented in LinqPad:
Aerospike Namespaces, Sets, Bins, etc. Representation in LINQPad
The LINQPad connection pane displays the different Aerospike components in an hierarchical manner where namespace is under Aerospike cluster connection. Aerospike sets are under namespaces, and bins are under sets. Below screenshot shows the relationship between these components:
You can drag-and-drop each component onto the LINQPad Query pane to be executed by LINQPad. The execution behavior depends on the component. For example, a set or secondary index will present the records within that component. For other components, the properties are displayed. In all cases, you can always execute the driver’s extension methods. These extension methods, greatly simplify Aerospike API commands like get
, put
, query
, operate
, etc. You can also import or export data. Of course, you can always use LINQ against Aerospike sets or secondary indexes. An example of some of the driver extensions follows:
IntelliSense Showing Some of the Extension Methods and Properties on a Set Object
For detailed information about the Aerospike LINQPad driver, see the ReadMe file in GitHub .
Installation
You can install the Aerospike Driver directly from the LINQPad NuGet Manager or from the GitHub Repo.
LINQPad NuGet Manager
Open LINQPad.
Click Add Connection Link.
Select View more drivers….
Select Show all drivers, and then type Aerospike.
Click Install.
Manual (GitHub)
Obtain the latest driver (.LPX6 file) from the Driver folder in GitHub and download it to your computer.
Open LINQPad.
Click Add Connection Link.
Click View more drivers…
Click Install driver from .LPX6 file… and select downloaded lpx6 file.