/// <summary> /// This method queries data from the collection. The query uses the clr function /// </summary> private void QueryWithClrFunctionProvider() { const string selectQuery = "SELECT EmployeeID, GetFullName(FirstName, LastName) as FullName, GetFullAddress(Address, City, Region, Country) as FullAddress FROM Employees WHERE EmployeeID = 2"; //Executing Select Query IDBCollectionReader reader = _database.ExecuteReader(selectQuery); int count = 0; while (reader.ReadNext()) { //Get String Attribute from Reader int employeeId = reader.GetInt32("EmployeeID"); string fullName = reader.GetString("FullName"); string fullAddress = reader.GetString("FullAddress"); Console.WriteLine("Document " + count); Console.WriteLine("EmployeeID: " + employeeId); Console.WriteLine("EmployeeName: " + fullName); Console.WriteLine("EmployeeAddress: " + fullAddress); Console.WriteLine(""); count++; } reader.Dispose(); Console.WriteLine("'" + count + "' documents were retrieved"); }