This is an automated email from the ASF dual-hosted git repository.

echobravo pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode-native.git

commit 60ff97a6e63cefc5b319582db4935e1242255890
Author: Ryan McMahon <mcmella...@gmail.com>
AuthorDate: Wed Feb 14 11:12:43 2018 -0800

    GEODE-4341: Working example of PutGetRemove
---
 .../Apache.Geode.Examples.PutGetRemove/Program.cs  | 89 +++++++++++++---------
 .../Apache.Geode.Examples.PutGetRemove/README.md   | 10 ++-
 2 files changed, 61 insertions(+), 38 deletions(-)

diff --git a/examples/dotnet/Apache.Geode.Examples.PutGetRemove/Program.cs 
b/examples/dotnet/Apache.Geode.Examples.PutGetRemove/Program.cs
index e78b623..7834411 100644
--- a/examples/dotnet/Apache.Geode.Examples.PutGetRemove/Program.cs
+++ b/examples/dotnet/Apache.Geode.Examples.PutGetRemove/Program.cs
@@ -1,51 +1,70 @@
 /*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*      http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
 
 using System;
 using Apache.Geode.Client;
 
 namespace Apache.Geode.Examples.Cache
 {
-  class Program
-  {
-    static void Main(string[] args)
+    class Program
     {
-      var cacheFactory = new CacheFactory()
-          .Set("log-level", "none");
-      var cache = cacheFactory.Create();
+        static void Main(string[] args)
+        {
+            var cacheFactory = new CacheFactory()
+                .Set("log-level", "none");
+            var cache = cacheFactory.Create();
 
-      var poolFactory = cache.GetPoolFactory()
-          .AddLocator("localhost", 10334);
-      poolFactory.Create("pool", cache);
+            var poolFactory = cache.GetPoolFactory()
+                .AddLocator("localhost", 10334);
+            poolFactory.Create("pool", cache);
 
-      var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
-          .SetPoolName("pool");
-      var region = regionFactory.Create<string, string>("region");
+            var regionFactory = cache.CreateRegionFactory(RegionShortcut.PROXY)
+                .SetPoolName("pool");
+            var region = regionFactory.Create<string, 
string>("example_userinfo");
 
-      region["a"] = "1";
-      region["b"] = "2";
+            Console.WriteLine("Storing id and username in the region");
 
-      var a = region["a"];
-      var b = region["b"];
+            const string rtimmonsKey = "rtimmons";
+            const string rtimmonsValue = "Robert Timmons";
+            const string scharlesKey = "scharles";
+            const string scharlesValue = "Sylvia Charles";
 
-      Console.Out.WriteLine("a = " + a);
-      Console.Out.WriteLine("b = " + b);
+            region.Put(rtimmonsKey, rtimmonsValue, null);
+            region.Put(scharlesKey, scharlesValue, null);
 
-      cache.Close();
+            Console.WriteLine("Getting the user info from the region");
+            var user1 = region.Get(rtimmonsKey, null);
+            var user2 = region.Get(scharlesKey, null);
+
+            Console.WriteLine(rtimmonsKey + " = " + user1);
+            Console.WriteLine(scharlesKey + " = " + user2);
+
+            Console.WriteLine("Removing " + rtimmonsKey + " info from the 
region");
+
+            if (region.Remove(rtimmonsKey))
+            {
+                Console.WriteLine("Info for " + rtimmonsKey + " has been 
deleted");
+            }
+            else
+            {
+                Console.WriteLine("Info for " + rtimmonsKey + " has not been 
deleted");
+            }
+
+            cache.Close();
+        }
     }
-  }
 }
diff --git a/examples/dotnet/Apache.Geode.Examples.PutGetRemove/README.md 
b/examples/dotnet/Apache.Geode.Examples.PutGetRemove/README.md
index 0478098..0d08e35 100644
--- a/examples/dotnet/Apache.Geode.Examples.PutGetRemove/README.md
+++ b/examples/dotnet/Apache.Geode.Examples.PutGetRemove/README.md
@@ -12,12 +12,16 @@ We then put, get, and remove some primitive data in the 
region.
   ```
   gfsh>start locator --name=locator
   gfsh>start server --name=server
-  gfsh>create region --name=region --type=PARTITION
+  gfsh>create region --name=example_userinfo --type=PARTITION
   ```
 * Execute `Apache.Geode.Examples.PutGetRemove.exe`.
   
   output:
   ```
-  a = 1
-  b = 2
+  Storing id and username in the region
+  Getting the user info from the region
+  rtimmons = Robert Timmons
+  scharles = Sylvia Charles
+  Removing rtimmons info from the region
+  Info for rtimmons has been deleted
   ```

-- 
To stop receiving notification emails like this one, please contact
echobr...@apache.org.

Reply via email to