Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 8C286200B81 for ; Fri, 5 Aug 2016 11:57:22 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 8AE5E160A8E; Fri, 5 Aug 2016 09:57:22 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C7294160AAF for ; Fri, 5 Aug 2016 11:57:21 +0200 (CEST) Received: (qmail 56275 invoked by uid 500); 5 Aug 2016 09:57:21 -0000 Mailing-List: contact dev-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list dev@ignite.apache.org Received: (qmail 56131 invoked by uid 99); 5 Aug 2016 09:57:20 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Aug 2016 09:57:20 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CF9112C0D5E for ; Fri, 5 Aug 2016 09:57:20 +0000 (UTC) Date: Fri, 5 Aug 2016 09:57:20 +0000 (UTC) From: "Pavel Tupitsyn (JIRA)" To: dev@ignite.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (IGNITE-3630) .NET: Add pure binary mode example with SQL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 05 Aug 2016 09:57:22 -0000 Pavel Tupitsyn created IGNITE-3630: -------------------------------------- Summary: .NET: Add pure binary mode example with SQL Key: IGNITE-3630 URL: https://issues.apache.org/jira/browse/IGNITE-3630 Project: Ignite Issue Type: Improvement Components: platforms Reporter: Pavel Tupitsyn Fix For: 1.8 This is an important Ignite use case: having no classes at all, working with cache in binary mode and running SQL queries. Below is a piece of code that I used for Gitter user question: {code} using (var ignite = Ignition.Start()) { // Configure queries for Person object with FirstName, LastName fields var cacheConfig = new CacheConfiguration { Name = "persons", // can be anything QueryEntities = new[] { new QueryEntity { KeyType = typeof(int), ValueTypeName = "Person", // name of the dynamically created type Fields = new[] // define fields to be available in queries { new QueryField("FirstName", typeof(string)), new QueryField("LastName", typeof(string)) } } } }; // Create new cache, switch to binary mode var cache = ignite.CreateCache(cacheConfig).WithKeepBinary(); // Populate the cache for (var i = 0; i < 10; i++) { var person = ignite.GetBinary().GetBuilder("Person") // same name as in ValueTypeName above .SetField("FirstName", "Name-" + i) .SetField("LastName", "LastName-" + i) .Build(); cache[i] = person; } // SQL query for FirstName ending with "-3" var qry = cache.Query(new SqlQuery("Person", "where FirstName like '%-3'")); foreach (ICacheEntry cacheEntry in qry) { Console.WriteLine("Person {0}:", cacheEntry.Key); IBinaryObject person = cacheEntry.Value; IBinaryType personType = person.GetBinaryType(); // Show all fields foreach (var fieldName in personType.Fields) Console.WriteLine(" {0}: {1}", fieldName, person.GetField(fieldName)); } } {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)