You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by jb...@apache.org on 2017/10/19 04:35:13 UTC
[geode-examples] branch master updated: Adds initial example for
Geode Native .NET client.
This is an automated email from the ASF dual-hosted git repository.
jbarrett pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/geode-examples.git
The following commit(s) were added to refs/heads/master by this push:
new 821a2fd Adds initial example for Geode Native .NET client.
821a2fd is described below
commit 821a2fd3886eb20c8a74bef30b88715d48f69f44
Author: Jacob Barrett <jb...@pivotal.io>
AuthorDate: Thu Oct 19 04:32:47 2017 +0000
Adds initial example for Geode Native .NET client.
---
.gitignore | 5 ++
README.md | 4 ++
.../Apache.Geode.Examples.Cache.csproj | 77 ++++++++++++++++++++++
.../dotnet/Apache.Geode.Examples.Cache/Program.cs | 48 ++++++++++++++
.../dotnet/Apache.Geode.Examples.Cache/README.md | 14 ++++
native/dotnet/Apache.Geode.Examples.sln | 21 ++++++
native/dotnet/README.md | 13 ++++
7 files changed, 182 insertions(+)
diff --git a/.gitignore b/.gitignore
index bc00815..b4d66f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,8 @@ server2
*.dat
*.rej
*.orig
+
+/native/dotnet/*/bin
+/native/dotnet/*/obj
+/native/dotnet/.vs
+
diff --git a/README.md b/README.md
index 1894591..77d492f 100644
--- a/README.md
+++ b/README.md
@@ -106,6 +106,10 @@ tutorial.
* Resource manager
* PDX Advanced
+### Native
+* C++
+* [.NET](native/dotnet/README.md)
+
### Use cases, integrations and external examples
This section has self-contained little projects that illustrate a use case or
diff --git a/native/dotnet/Apache.Geode.Examples.Cache/Apache.Geode.Examples.Cache.csproj b/native/dotnet/Apache.Geode.Examples.Cache/Apache.Geode.Examples.Cache.csproj
new file mode 100644
index 0000000..b108c40
--- /dev/null
+++ b/native/dotnet/Apache.Geode.Examples.Cache/Apache.Geode.Examples.Cache.csproj
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+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.
+-->
+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{15ACFB5B-0D2C-4C38-9236-7AF01874A84F}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>Apache.Geode.Examples.Cache</RootNamespace>
+ <AssemblyName>Apache.Geode.Examples.Cache</AssemblyName>
+ <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\x64\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <DebugType>full</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
+ <OutputPath>bin\x64\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>x64</PlatformTarget>
+ <ErrorReport>prompt</ErrorReport>
+ <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
+ <Prefer32Bit>true</Prefer32Bit>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Apache.Geode">
+ <HintPath>Y:\build64\clicache\src\Debug\Apache.Geode.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="Microsoft.CSharp" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="README.md" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
diff --git a/native/dotnet/Apache.Geode.Examples.Cache/Program.cs b/native/dotnet/Apache.Geode.Examples.Cache/Program.cs
new file mode 100644
index 0000000..52aa3a8
--- /dev/null
+++ b/native/dotnet/Apache.Geode.Examples.Cache/Program.cs
@@ -0,0 +1,48 @@
+/*
+ * 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)
+ {
+ var cacheFactory = CacheFactory.CreateCacheFactory();
+ var cache = cacheFactory.Create();
+
+ 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");
+
+ region["a"] = "1";
+ region["b"] = "2";
+
+ var a = region["a"];
+ var b = region["b"];
+
+ Console.Out.WriteLine("a = " + a);
+ Console.Out.WriteLine("b = " + b);
+ }
+ }
+}
diff --git a/native/dotnet/Apache.Geode.Examples.Cache/README.md b/native/dotnet/Apache.Geode.Examples.Cache/README.md
new file mode 100644
index 0000000..167eaa4
--- /dev/null
+++ b/native/dotnet/Apache.Geode.Examples.Cache/README.md
@@ -0,0 +1,14 @@
+# Cache Example
+
+## Prerequisits
+* Install [Apache Geode](https://geode.apache.org)
+* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
+
+## Running
+* Start Geode Server and create region.
+ ```
+ gfsh>start locator --name=locator
+ gfsh>start server --name=server
+ gfsh>create region --name=region --type=PARTITION
+ ```
+* Execute `Apache.Geode.Examples.Cache.exe`.
diff --git a/native/dotnet/Apache.Geode.Examples.sln b/native/dotnet/Apache.Geode.Examples.sln
new file mode 100644
index 0000000..88dc3e8
--- /dev/null
+++ b/native/dotnet/Apache.Geode.Examples.sln
@@ -0,0 +1,21 @@
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Apache.Geode.Examples.Cache", "Apache.Geode.Examples.Cache\Apache.Geode.Examples.Cache.csproj", "{15ACFB5B-0D2C-4C38-9236-7AF01874A84F}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x64 = Debug|x64
+ Release|x64 = Release|x64
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {15ACFB5B-0D2C-4C38-9236-7AF01874A84F}.Debug|x64.ActiveCfg = Debug|x64
+ {15ACFB5B-0D2C-4C38-9236-7AF01874A84F}.Debug|x64.Build.0 = Debug|x64
+ {15ACFB5B-0D2C-4C38-9236-7AF01874A84F}.Release|x64.ActiveCfg = Release|x64
+ {15ACFB5B-0D2C-4C38-9236-7AF01874A84F}.Release|x64.Build.0 = Release|x64
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/native/dotnet/README.md b/native/dotnet/README.md
new file mode 100644
index 0000000..ef6c1dd
--- /dev/null
+++ b/native/dotnet/README.md
@@ -0,0 +1,13 @@
+# Geode Native .NET Examples
+
+## Prerequisits
+* Install [Apache Geode](https://geode.apache.org)
+* Build and install [Apache Geode Native](https://github.com/apache/geode-native)
+
+## Solution Includes
+* [Apache.Geode.Examples.Cache](Apache.Geode.Examples.Cache/README.md)
+
+## Using
+1) Open `Apache.Geode.Examples.sln` in [Visual Studio 2015](https://www.visualstudio.com/)
+or newer.
+2) Update `Apache.Geode` reference in each project to the `Apache.Geode.dll` assembly.
\ No newline at end of file
--
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].