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/05/17 17:50:13 UTC

[31/46] geode-native git commit: GEODE-2741: Remove custom shared pointer from clicache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedAuthInitialize.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedAuthInitialize.cpp b/src/clicache/src/impl/ManagedAuthInitialize.cpp
index 67fef16..4ad28bb 100644
--- a/src/clicache/src/impl/ManagedAuthInitialize.cpp
+++ b/src/clicache/src/impl/ManagedAuthInitialize.cpp
@@ -174,11 +174,10 @@ namespace apache
                                                                  securityprops, const char* server)
       {
         try {
-          Apache::Geode::Client::Properties<String^, String^>^ mprops =
-            Apache::Geode::Client::Properties<String^, String^>::Create<String^, String^>(securityprops.get());
+          auto mprops = Apache::Geode::Client::Properties<String^, String^>::Create(securityprops);
           String^ mg_server = Apache::Geode::Client::ManagedString::Get(server);
 
-          return PropertiesPtr(m_getCredentials->Invoke(mprops, mg_server)->NativePtr());
+          return m_getCredentials->Invoke(mprops, mg_server)->GetNative();
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
           ex->ThrowNative();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedAuthInitialize.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedAuthInitialize.hpp b/src/clicache/src/impl/ManagedAuthInitialize.hpp
index 45c9e05..482a9e7 100644
--- a/src/clicache/src/impl/ManagedAuthInitialize.hpp
+++ b/src/clicache/src/impl/ManagedAuthInitialize.hpp
@@ -18,7 +18,10 @@
 #pragma once
 
 #include "../geode_defs.hpp"
+#include "begin_native.hpp"
 #include <geode/AuthInitialize.hpp>
+#include "end_native.hpp"
+
 #include <vcclr.h>
 #include "../IAuthInitialize.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheListener.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheListener.cpp b/src/clicache/src/impl/ManagedCacheListener.cpp
index 56292ba..171eeb4 100644
--- a/src/clicache/src/impl/ManagedCacheListener.cpp
+++ b/src/clicache/src/impl/ManagedCacheListener.cpp
@@ -331,7 +331,7 @@ namespace apache
       {
         try {
           Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
-            Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
+            Apache::Geode::Client::Region<Object^, Object^>::Create(region);
 
           m_managedptr->Close(mregion);
         }
@@ -346,7 +346,7 @@ namespace apache
       {
         try {
           Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
-            Apache::Geode::Client::Region<Object^, Object^>::Create(region.get());
+            Apache::Geode::Client::Region<Object^, Object^>::Create(region);
           m_managedptr->AfterRegionDisconnected(mregion);
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheListener.hpp b/src/clicache/src/impl/ManagedCacheListener.hpp
index 0e32e6d..ccc80d7 100644
--- a/src/clicache/src/impl/ManagedCacheListener.hpp
+++ b/src/clicache/src/impl/ManagedCacheListener.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheListener.hpp>
+#include "end_native.hpp"
+
 #include "../ICacheListener.hpp"
 
 namespace apache {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheLoader.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheLoader.cpp b/src/clicache/src/impl/ManagedCacheLoader.cpp
index cba68db..21e9657 100644
--- a/src/clicache/src/impl/ManagedCacheLoader.cpp
+++ b/src/clicache/src/impl/ManagedCacheLoader.cpp
@@ -218,19 +218,6 @@ namespace apache
                                                    const CacheableKeyPtr& key, const UserDataPtr& aCallbackArgument)
       {
         try {
-          /*
-          Region<Object^, Object^>^ mregion =
-          Region<Object^, Object^>::Create( region.ptr( ) );
-
-          ICacheableKey^ mkey = SafeGenericUMKeyConvert( key.ptr( ) );
-
-          IGeodeSerializable^ mcallbackArg = SafeGenericUMSerializableConvert(aCallbackArgument.get());
-          */
-
-          /*
-          return apache::geode::client::CacheablePtr(SafeMSerializableConvert(
-          m_managedptr->Load(mregion, mkey, mcallbackArg)));
-          */
           return m_managedptr->load(region, key, aCallbackArgument);
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
@@ -247,7 +234,7 @@ namespace apache
         try {
           /*
           Apache::Geode::Client::Region^ mregion =
-          Apache::Geode::Client::Region::Create( region.ptr( ) );
+          Apache::Geode::Client::Region::Create( region.get() );
           */
 
           m_managedptr->close(region);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheLoader.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheLoader.hpp b/src/clicache/src/impl/ManagedCacheLoader.hpp
index b59d8d5..4d09d49 100644
--- a/src/clicache/src/impl/ManagedCacheLoader.hpp
+++ b/src/clicache/src/impl/ManagedCacheLoader.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheLoader.hpp>
+#include "end_native.hpp"
+
 
 #include "../ICacheLoader.hpp"
 #include "CacheLoader.hpp"

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheWriter.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheWriter.cpp b/src/clicache/src/impl/ManagedCacheWriter.cpp
index e9077ae..646cf7e 100644
--- a/src/clicache/src/impl/ManagedCacheWriter.cpp
+++ b/src/clicache/src/impl/ManagedCacheWriter.cpp
@@ -298,7 +298,7 @@ namespace apache
       {
         try {
           Apache::Geode::Client::IRegion<Object^, Object^>^ mregion =
-            Apache::Geode::Client::Region<Object^, Object^>::Create(rp.get());
+            Apache::Geode::Client::Region<Object^, Object^>::Create(rp);
 
           m_managedptr->Close(reinterpret_cast<Apache::Geode::Client::Region<Object^, Object^>^>(mregion));
         }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheWriter.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheWriter.hpp b/src/clicache/src/impl/ManagedCacheWriter.hpp
index 9120a8d..0b6eba1 100644
--- a/src/clicache/src/impl/ManagedCacheWriter.hpp
+++ b/src/clicache/src/impl/ManagedCacheWriter.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheWriter.hpp>
+#include "end_native.hpp"
+
 #include "../ICacheWriter.hpp"
 
 using namespace System;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDelta.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDelta.cpp b/src/clicache/src/impl/ManagedCacheableDelta.cpp
index fb58f5a..75fc5cf 100644
--- a/src/clicache/src/impl/ManagedCacheableDelta.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDelta.cpp
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "ManagedCacheableDelta.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "SafeConvert.hpp"
 
@@ -240,7 +242,7 @@ namespace apache
       bool ManagedCacheableDeltaGeneric::operator == (const ManagedCacheableDeltaGeneric& other) const
       {
         try {
-          return m_managedptr->Equals(other.get());
+          return m_managedptr->Equals(other.ptr());
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
           ex->ThrowNative();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDelta.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDelta.hpp b/src/clicache/src/impl/ManagedCacheableDelta.hpp
index cb8e14d..a531178 100644
--- a/src/clicache/src/impl/ManagedCacheableDelta.hpp
+++ b/src/clicache/src/impl/ManagedCacheableDelta.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/Delta.hpp>
+#include "end_native.hpp"
+
 #include "../IGeodeDelta.hpp"
 #include "../IGeodeSerializable.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
index 494671d..e7f590c 100644
--- a/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableDeltaBytes.cpp
@@ -15,12 +15,14 @@
  * limitations under the License.
  */
 
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "ManagedCacheableDeltaBytes.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "SafeConvert.hpp"
 
@@ -36,7 +38,7 @@ namespace apache
 
       void ManagedCacheableDeltaBytesGeneric::toData(DataOutput& output) const
       {
-        Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+        Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
         try {
           output.writeBytesOnly(m_bytes, m_size);
         }
@@ -158,7 +160,7 @@ namespace apache
       void ManagedCacheableDeltaBytesGeneric::toDelta(DataOutput& output) const
       {
         try {
-          Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+          Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
           Apache::Geode::Client::IGeodeDelta^ deltaObj = this->getManagedObject();
           Apache::Geode::Client::DataOutput mg_output(&output, true);
           deltaObj->ToDelta(%mg_output);
@@ -184,7 +186,7 @@ namespace apache
             dynamic_cast <Apache::Geode::Client::IGeodeSerializable^> (deltaObj);
           if (managedptr != nullptr)
           {
-            Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+            Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
             Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
             apache::geode::client::DataOutput dataOut;
             Apache::Geode::Client::DataOutput mg_output(&dataOut, true);
@@ -288,7 +290,7 @@ namespace apache
           Apache::Geode::Client::IGeodeSerializable^ obj =
             Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
           obj->FromData(%mg_input);
-          bool ret = obj->Equals(other.get());
+          bool ret = obj->Equals(other.ptr());
           Apache::Geode::Client::Log::Debug("ManagedCacheableDeltaBytesGeneric::equal return VAL = " + ret);
           return ret;
           //return obj->Equals(other.get());

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp b/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
index aab663f..905d08a 100644
--- a/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
+++ b/src/clicache/src/impl/ManagedCacheableDeltaBytes.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/Delta.hpp>
+#include "end_native.hpp"
+
 #include "../Log.hpp"
 #include "../DataOutput.hpp"
 
@@ -78,7 +81,7 @@ namespace apache
           if (managedptr != nullptr)
           {
             m_classId = managedptr->ClassId;
-            Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+            Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
             Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString() + " storeBytes:" + storeBytes);
             if (storeBytes)
             {
@@ -111,7 +114,7 @@ namespace apache
             if(managedptr != nullptr)
             {
             m_classId = managedptr->ClassId;
-            Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+            Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
             Apache::Geode::Client::Log::Fine("ManagedCacheableDeltaBytes::Constructor: class ID " + managedptr->ClassId + " : " + managedptr->ToString());
             apache::geode::client::DataOutput dataOut;
             Apache::Geode::Client::DataOutput mg_output( &dataOut);
@@ -206,7 +209,7 @@ namespace apache
 
         inline ~ManagedCacheableDeltaBytesGeneric()
         {
-          Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+          Apache::Geode::Client::Log::Finer("ManagedCacheableDeltaBytes::Destructor current AppDomain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
           GF_SAFE_DELETE(m_bytes);
         }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKey.cpp b/src/clicache/src/impl/ManagedCacheableKey.cpp
index e990c20..d30d41e 100644
--- a/src/clicache/src/impl/ManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKey.cpp
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "../ICacheableKey.hpp"
 #include "ManagedCacheableKey.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "../Log.hpp"
 
@@ -191,7 +193,7 @@ namespace apache
         try {
           return static_cast<Apache::Geode::Client::ICacheableKey^>(
             (Apache::Geode::Client::IGeodeSerializable^)(Apache::Geode::Client::IGeodeSerializable^)m_managedptr)->Equals(
-            static_cast<Apache::Geode::Client::ICacheableKey^>(other.get()));
+            static_cast<Apache::Geode::Client::ICacheableKey^>(other.ptr()));
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
           ex->ThrowNative();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKey.hpp b/src/clicache/src/impl/ManagedCacheableKey.hpp
index 9c7ea09..27fa215 100644
--- a/src/clicache/src/impl/ManagedCacheableKey.hpp
+++ b/src/clicache/src/impl/ManagedCacheableKey.hpp
@@ -19,8 +19,11 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheableKey.hpp>
 #include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "../IGeodeSerializable.hpp"
 
 using namespace System;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
index d8c5b56..5d39280 100644
--- a/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/ManagedCacheableKeyBytes.cpp
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "ManagedCacheableKeyBytes.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../Serializable.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "ManagedString.hpp"
 
@@ -36,7 +38,7 @@ namespace apache
     {
       void ManagedCacheableKeyBytesGeneric::toData(apache::geode::client::DataOutput& output) const
       {
-        Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+        Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
         try {
           //TODO: I think this should work as it is
           output.writeBytesOnly(m_bytes, m_size);
@@ -214,7 +216,7 @@ namespace apache
           Apache::Geode::Client::IGeodeSerializable^ obj =
             Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
           obj->FromData(%mg_input);
-          bool ret = obj->Equals(other.get());
+          bool ret = obj->Equals(other.ptr());
           Apache::Geode::Client::Log::Debug("ManagedCacheableKeyBytesGeneric::equal return VAL = " + ret);
           return ret;
           //return obj->Equals(other.get());

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp b/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
index 3a23a94..e0b4ecf 100644
--- a/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
+++ b/src/clicache/src/impl/ManagedCacheableKeyBytes.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheableKey.hpp>
+#include "end_native.hpp"
+
 #include "../Log.hpp"
 #include "../DataOutput.hpp"
 
@@ -174,7 +177,7 @@ namespace apache
           Apache::Geode::Client::Log::Fine(
             "ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
             System::Threading::Thread::GetDomainID() + " for object: " +
-            System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+            System::Convert::ToString((UInt64) this) + " with its AppDomain ID: " + m_domainId);
           GF_SAFE_DELETE(m_bytes);
         }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCqListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCqListener.hpp b/src/clicache/src/impl/ManagedCqListener.hpp
index 5dfbbc8..f5a3267 100644
--- a/src/clicache/src/impl/ManagedCqListener.hpp
+++ b/src/clicache/src/impl/ManagedCqListener.hpp
@@ -18,7 +18,10 @@
 #pragma once
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CqListener.hpp>
+#include "end_native.hpp"
+
 //#include "../ICqListener.hpp"
 #include "../ICqListener.hpp"
 #include "CqListenerProxy.hpp"

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedCqStatusListener.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedCqStatusListener.hpp b/src/clicache/src/impl/ManagedCqStatusListener.hpp
index 344e0c6..42a2988 100644
--- a/src/clicache/src/impl/ManagedCqStatusListener.hpp
+++ b/src/clicache/src/impl/ManagedCqStatusListener.hpp
@@ -19,7 +19,10 @@
 #pragma once
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CqStatusListener.hpp>
+#include "end_native.hpp"
+
 #include "../ICqStatusListener.hpp"
 #include "CqStatusListenerProxy.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp b/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
index 941fb7e..aba0bf0 100644
--- a/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
+++ b/src/clicache/src/impl/ManagedFixedPartitionResolver.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/FixedPartitionResolver.hpp>
+#include "end_native.hpp"
+
 
 #include "FixedPartitionResolver.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedPartitionResolver.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedPartitionResolver.hpp b/src/clicache/src/impl/ManagedPartitionResolver.hpp
index 2ff9cae..9640cf9 100644
--- a/src/clicache/src/impl/ManagedPartitionResolver.hpp
+++ b/src/clicache/src/impl/ManagedPartitionResolver.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/PartitionResolver.hpp>
+#include "end_native.hpp"
+
 
 #include "PartitionResolver.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedPersistenceManager.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedPersistenceManager.hpp b/src/clicache/src/impl/ManagedPersistenceManager.hpp
index 6648cc9..6f19e0a 100644
--- a/src/clicache/src/impl/ManagedPersistenceManager.hpp
+++ b/src/clicache/src/impl/ManagedPersistenceManager.hpp
@@ -19,7 +19,10 @@
 #pragma once
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/PersistenceManager.hpp>
+#include "end_native.hpp"
+
 #include "PersistenceManagerProxy.hpp"
 
 namespace apache {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedResultCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedResultCollector.cpp b/src/clicache/src/impl/ManagedResultCollector.cpp
index 2ac9e0a..91a353d 100644
--- a/src/clicache/src/impl/ManagedResultCollector.cpp
+++ b/src/clicache/src/impl/ManagedResultCollector.cpp
@@ -149,10 +149,8 @@ namespace apache
       void ManagedResultCollectorGeneric::addResult(CacheablePtr& result)
       {
         try {
-          //Apache::Geode::Client::IGeodeSerializable^ res = SafeUMSerializableConvertGeneric(result.get());
           Object^ rs = Apache::Geode::Client::Serializable::GetManagedValueGeneric<Object^>(result);
           m_managedptr->AddResult(rs);
-          //m_managedptr->AddResult( SafeUMSerializableConvert( result.ptr( ) ) );
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
           ex->ThrowNative();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedResultCollector.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedResultCollector.hpp b/src/clicache/src/impl/ManagedResultCollector.hpp
index bc1223f..a4eb34d 100644
--- a/src/clicache/src/impl/ManagedResultCollector.hpp
+++ b/src/clicache/src/impl/ManagedResultCollector.hpp
@@ -18,7 +18,10 @@
 #pragma once
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/ResultCollector.hpp>
+#include "end_native.hpp"
+
 //#include "../ResultCollector.hpp"
 //#include "../IResultCollector.hpp"
 //#include "../../../IResultCollector.hpp"

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedVisitor.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedVisitor.cpp b/src/clicache/src/impl/ManagedVisitor.cpp
index 3ab01a1..3808ea8 100644
--- a/src/clicache/src/impl/ManagedVisitor.cpp
+++ b/src/clicache/src/impl/ManagedVisitor.cpp
@@ -34,8 +34,8 @@ namespace apache
       {
         using namespace Apache::Geode::Client;
         try {
-          ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key.get()));
-          IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value.get()));
+          ICacheableKey^ mg_key(SafeGenericUMKeyConvert<ICacheableKey^>(key));
+          IGeodeSerializable^ mg_value(SafeUMSerializableConvertGeneric(value));
 
           m_visitor->Invoke(mg_key, (Apache::Geode::Client::IGeodeSerializable^)mg_value);
         }

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/ManagedVisitor.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/ManagedVisitor.hpp b/src/clicache/src/impl/ManagedVisitor.hpp
index 229a482..a9f5947 100644
--- a/src/clicache/src/impl/ManagedVisitor.hpp
+++ b/src/clicache/src/impl/ManagedVisitor.hpp
@@ -19,7 +19,10 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/Properties.hpp>
+#include "end_native.hpp"
+
 #include "../Properties.hpp"
 
 //using namespace apache::geode::client;

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/MemoryPressureHandler.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/MemoryPressureHandler.cpp b/src/clicache/src/impl/MemoryPressureHandler.cpp
index bf3d80d..080fa3a 100644
--- a/src/clicache/src/impl/MemoryPressureHandler.cpp
+++ b/src/clicache/src/impl/MemoryPressureHandler.cpp
@@ -65,12 +65,11 @@ namespace Apache
         return 0;
       }
 
-      int MemoryPressureHandler::handle_close( ACE_HANDLE handle,
-          ACE_Reactor_Mask close_mask )
+      int MemoryPressureHandler::handle_close(ACE_HANDLE handle,
+        ACE_Reactor_Mask close_mask)
       {
         return 0;
+      }
     }  // namespace Client
   }  // namespace Geode
 }  // namespace Apache
-
- } //namespace 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/MemoryPressureHandler.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/MemoryPressureHandler.hpp b/src/clicache/src/impl/MemoryPressureHandler.hpp
index 59d2232..c8ac0e7 100644
--- a/src/clicache/src/impl/MemoryPressureHandler.hpp
+++ b/src/clicache/src/impl/MemoryPressureHandler.hpp
@@ -17,8 +17,10 @@
 
 #pragma once
 
+#include "begin_native.hpp"
 #include <geode/geode_globals.hpp>
 #include <ExpiryTaskManager.hpp>
+#include "end_native.hpp"
 
 namespace Apache
 {

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/NativeWrapper.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/NativeWrapper.hpp b/src/clicache/src/impl/NativeWrapper.hpp
deleted file mode 100644
index dad7b6a..0000000
--- a/src/clicache/src/impl/NativeWrapper.hpp
+++ /dev/null
@@ -1,528 +0,0 @@
-/*
- * 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.
- */
-
-#pragma once
-
-
-
-#include "../geode_defs.hpp"
-
-using namespace System;
-
-namespace Apache
-{
-  namespace Geode
-  {
-    namespace Client
-    {
-
-      namespace Internal
-      {
-
-        /// <summary>
-        /// Internal class used to keep a reference of the managed object
-        /// alive while a method on the native object is in progress
-        /// (fix for bug #309)
-        /// </summary>
-        template <typename TNative, typename TManaged>
-        public value class ManagedPtrWrap
-        {
-        public:
-          inline ManagedPtrWrap(TNative* nativePtr, TManaged^ mgObj) :
-              m_nativePtr(nativePtr), m_mgObj(mgObj) { }
-          inline TNative* operator->()
-          {
-            return m_nativePtr;
-          }
-          inline TNative* operator()()
-          {
-            return m_nativePtr;
-          }
-
-        private:
-          TNative* m_nativePtr;
-          TManaged^ m_mgObj;
-        };
-
-        /// <summary>
-        /// Internal class to wrap native object pointers that derive from
-        /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// This is a convenience template class to wrap native class objects
-        /// that derive from <c>SharedBase</c>.
-        /// The native class objects can be of two kinds -- one that derive from
-        /// SharedBase and are handled using smart pointers, and the second that
-        /// do not derive from SharedBase. For the first category we have to invoke
-        /// <c>preserveSB()</c> and <c>releaseSB()</c> on the native object during
-        /// construction and dispose/finalization of the wrapped object.
-        /// </para><para>
-        /// All the managed wrapper classes that wrap corresponding native classes
-        /// deriving from <c>SharedBase</c> should derive from this class.
-        /// </para><para>
-        /// <b>IMPORTANT:</b> Direct assignment of m_nativeptr has been disabled,
-        /// rather the classes deriving from this should use
-        /// <c>SBWrap.SetPtr</c> or <c>SBWrap._SetNativePtr</c>
-        /// </para><para>
-        /// This class is intentionally <b>not</b> thread-safe.
-        /// </para>
-        /// </remarks>
-        template<typename NTYPE>
-        public ref class SBWrap
-        {
-        public:
-
-          /// <summary>
-          /// The dispose function.
-          /// </summary>
-          inline ~SBWrap( )
-          {
-            InternalCleanup( );
-          }
-
-          /// <summary>
-          /// The finalizer, for the case dispose is not called.
-          /// </summary>
-          inline !SBWrap( )
-          {
-            InternalCleanup( );
-          }
-
-
-        internal:
-
-          /// <summary>
-          /// Default constructor initializes the native pointer to null.
-          /// </summary>
-          inline SBWrap( ): m_nativeptr( nullptr ) { }
-
-          /// <summary>
-          /// Constructor to wrap the given native pointer.
-          /// </summary>
-          inline SBWrap( NTYPE* nativeptr ): m_nativeptr( nativeptr )
-          {
-            if (nativeptr != nullptr)
-            {
-              nativeptr->preserveSB( );
-            }
-          }
-
-          /// <summary>
-          /// Get the reference to underlying native object.
-          /// </summary>
-          /// <returns>
-          /// The native pointer wrapped inside ManagedPtrWrap object.
-          /// </returns>
-          property ManagedPtrWrap< NTYPE, SBWrap<NTYPE> > NativePtr
-          {
-            inline ManagedPtrWrap< NTYPE, SBWrap<NTYPE> > get()
-            {
-              return ManagedPtrWrap< NTYPE, SBWrap<NTYPE> >(m_nativeptr, this);
-            }
-          }
-
-          /// <summary>
-          /// Get the underlying native pointer.
-          /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
-          /// </summary>
-          /// <returns>The native pointer.</returns>
-          property NTYPE* _NativePtr
-          {
-            inline NTYPE* get()
-            {
-              return m_nativeptr;
-            }
-          }
-
-
-        protected:
-
-          /// <summary>
-          /// Used to set the native pointer to a new object. This should only be
-          /// used when you know that the underlying object is NULL.
-          /// </summary>
-          inline void SetPtr( NTYPE* nativeptr )
-          {
-            if (nativeptr != nullptr)
-            {
-              nativeptr->preserveSB( );
-            }
-            m_nativeptr = nativeptr;
-          }
-
-          /// <summary>
-          /// Used to assign the native pointer to a new object.
-          /// </summary>
-          /// <remarks>
-          /// Note the order of preserveSB() and releaseSB(). This handles the
-          /// corner case when <c>m_nativeptr</c> is same as <c>nativeptr</c>.
-          /// </remarks>
-          inline void AssignPtr( NTYPE* nativeptr )
-          {
-            if (nativeptr != nullptr) {
-              nativeptr->preserveSB();
-            }
-            if (m_nativeptr != nullptr) {
-              m_nativeptr->releaseSB();
-            }
-            m_nativeptr = nativeptr;
-          }
-
-          /// <summary>
-          /// Set the native pointer to the new object without doing a
-          /// preserveSB(). DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING.
-          /// </summary>
-          inline void _SetNativePtr( NTYPE* nativeptr )
-          {
-            m_nativeptr = nativeptr;
-          }
-
-          /// <summary>
-          /// Internal cleanup function invoked by dispose/finalizer.
-          /// </summary>
-          inline void InternalCleanup( )
-          {
-            if (m_nativeptr != nullptr)
-            {
-              m_nativeptr->releaseSB( );
-              m_nativeptr = nullptr;
-            }
-          }
-
-
-        private:
-
-          NTYPE* m_nativeptr;
-        };
-
-
-        /// <summary>
-        /// Internal class to wrap native object pointers that do not derive from
-        /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// This is a convenience template class to wrap native class objects
-        /// that do not derive from SharedBase.
-        /// </para><para>
-        /// The constructors (and <c>SetPtr</c> method) of this class require a
-        /// boolean parameter that informs whether or not to take ownership
-        /// of the native object. When the ownership is taken, then the
-        /// native object is destroyed when the wrapper object is
-        /// disposed/finalized, otherwise it is not.
-        /// </para><para>
-        /// All the managed wrapper classes that wrap corresponding native classes
-        /// not deriving from <c>SharedBase</c> should derive from this class.
-        /// </para><para>
-        /// <b>IMPORTANT</b>: Direct assignment of m_nativeptr has been disabled,
-        /// rather the classes deriving from this should use <c>UMWrap.SetPtr</c>
-        /// that also requires a boolean parameter to indicate whether or not
-        /// to take ownership of the native object.
-        /// </para><para>
-        /// This class is intentionally <b>not</b> thread-safe.
-        /// </para>
-        /// </remarks>
-        template<typename NTYPE>
-        public ref class UMWrap
-        {
-        public:
-
-          /// <summary>
-          /// The dispose function.
-          /// </summary>
-          inline ~UMWrap( )
-          {
-            InternalCleanup( );
-          }
-
-          /// <summary>
-          /// The finalizer, for the case dispose is not called.
-          /// </summary>
-          inline !UMWrap( )
-          {
-            InternalCleanup( );
-          }
-
-
-        internal:
-
-          /// <summary>
-          /// Default constructor assigns null to the native pointer and takes
-          /// ownership of the object.
-          /// </summary>
-          inline UMWrap( )
-            : m_nativeptr( nullptr ), m_own( true ) { }
-
-          /// <summary>
-          /// Constructor to wrap the given native object and inform about
-          /// the ownership of the native object.
-          /// </summary>
-          inline UMWrap( NTYPE* nativeptr, bool own )
-            : m_nativeptr( nativeptr ), m_own( own )
-          {
-            if (!own)
-            {
-              GC::SuppressFinalize( this );
-            }
-          }
-
-          /// <summary>
-          /// Get the reference to underlying native object.
-          /// </summary>
-          /// <returns>
-          /// The native pointer wrapped inside NativePtrWrap object.
-          /// </returns>
-          property ManagedPtrWrap< NTYPE, UMWrap<NTYPE> > NativePtr
-          {
-            inline ManagedPtrWrap< NTYPE, UMWrap<NTYPE> > get()
-            {
-              return ManagedPtrWrap< NTYPE, UMWrap<NTYPE> >(m_nativeptr, this);
-            }
-          }
-
-          /// <summary>
-          /// Get the underlying native pointer.
-          /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
-          /// </summary>
-          /// <returns>The native pointer.</returns>
-          property NTYPE* _NativePtr
-          {
-            inline NTYPE* get()
-            {
-              return m_nativeptr;
-            }
-          }
-
-
-        protected:
-
-          /// <summary>
-          /// Get or set the ownership of this object.
-          /// </summary>
-          /// <returns>True if the native object is owned by this object.</returns>
-          property bool Own
-          {
-            inline bool get( )
-            {
-              return m_own;
-            }
-            inline void set( bool own )
-            {
-              if (m_own != own)
-              {
-                if (own)
-                {
-                  GC::ReRegisterForFinalize( this );
-                }
-                else
-                {
-                  GC::SuppressFinalize( this );
-                }
-              }
-              m_own = own;
-            }
-          }
-
-          /// <summary>
-          /// Used to set the native pointer to a new object. This should only
-          /// be used when you know that the underlying object is NULL
-          /// or you do not own it.
-          /// </summary>
-          inline void SetPtr( NTYPE* nativeptr, bool own )
-          {
-            m_nativeptr = nativeptr;
-            m_own = own;
-          }
-
-          /// <summary>
-          /// Internal cleanup function invoked by dispose/finalizer.
-          /// </summary>
-          inline void InternalCleanup( )
-          {
-            if (m_own && m_nativeptr != nullptr)
-            {
-              delete m_nativeptr;
-              m_nativeptr = nullptr;
-            }
-          }
-
-
-        private:
-
-          NTYPE* m_nativeptr;
-          bool m_own;
-        };
-
-        /// <summary>
-        /// Internal class to wrap native object pointers that do not derive from
-        /// <c>SharedBase</c>; <c>NTYPE</c> is the native class.
-        /// </summary>
-        /// <remarks>
-        /// <para>
-        /// This is a convenience template class to wrap native class objects
-        /// that do not derive from SharedBase.
-        /// </para><para>
-        /// The constructors (and <c>SetPtr</c> method) of this class require a
-        /// boolean parameter that informs whether or not to take ownership
-        /// of the native object. Even if the ownership is taken, the
-        /// native object is purposefully not destroyed as the class that impelements 
-        /// it has the protected or the private destructor.
-        /// </para><para>
-        /// All the managed wrapper classes that wrap corresponding native classes
-        /// not deriving from <c>SharedBase</c> should derive from this class.
-        /// </para><para>
-        /// <b>IMPORTANT</b>: Direct assignment of m_nativeptr has been disabled,
-        /// rather the classes deriving from this should use <c>UMWrap.SetPtr</c>
-        /// that also requires a boolean parameter to indicate whether or not
-        /// to take ownership of the native object.
-        /// </para><para>
-        /// This class is intentionally <b>not</b> thread-safe.
-        /// </para>
-        /// </remarks>
-        template<typename NTYPE>
-        public ref class UMWrapN
-        {
-        public:
-
-          /// <summary>
-          /// The dispose function.
-          /// </summary>
-          inline ~UMWrapN( )
-          {
-            InternalCleanup( );
-          }
-
-          /// <summary>
-          /// The finalizer, for the case dispose is not called.
-          /// </summary>
-          inline !UMWrapN( )
-          {
-            InternalCleanup( );
-          }
-
-        internal:
-
-          /// <summary>
-          /// Default constructor assigns null to the native pointer and takes
-          /// ownership of the object.
-          /// </summary>
-          inline UMWrapN( )
-            : m_nativeptr( nullptr ), m_own( true ) { }
-
-          /// <summary>
-          /// Constructor to wrap the given native object and inform about
-          /// the ownership of the native object.
-          /// </summary>
-          inline UMWrapN( NTYPE* nativeptr, bool own )
-            : m_nativeptr( nativeptr ), m_own( own )
-          {
-            if (!own)
-            {
-              GC::SuppressFinalize( this );
-            }
-          }
-
-          /// <summary>
-          /// Get the reference to underlying native object.
-          /// </summary>
-          /// <returns>
-          /// The native pointer wrapped inside NativePtrWrap object.
-          /// </returns>
-          property ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> > NativePtr
-          {
-            inline ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> > get()
-            {
-              return ManagedPtrWrap< NTYPE, UMWrapN<NTYPE> >(m_nativeptr, this);
-            }
-          }
-
-          /// <summary>
-          /// Get the underlying native pointer.
-          /// DO NOT USE UNLESS YOU KNOW WHAT YOU ARE DOING. SEE BUG #309.
-          /// </summary>
-          /// <returns>The native pointer.</returns>
-          property NTYPE* _NativePtr
-          {
-            inline NTYPE* get()
-            {
-              return m_nativeptr;
-            }
-          }
-
-        protected:
-
-          /// <summary>
-          /// Get or set the ownership of this object.
-          /// </summary>
-          /// <returns>True if the native object is owned by this object.</returns>
-          property bool Own
-          {
-            inline bool get( )
-            {
-              return m_own;
-            }
-            inline void set( bool own )
-            {
-              if (m_own != own)
-              {
-                if (own)
-                {
-                  GC::ReRegisterForFinalize( this );
-                }
-                else
-                {
-                  GC::SuppressFinalize( this );
-                }
-              }
-              m_own = own;
-            }
-          }
-
-          /// <summary>
-          /// Used to set the native pointer to a new object. This should only
-          /// be used when you know that the underlying object is NULL
-          /// or you do not own it.
-          /// </summary>
-          inline void SetPtr( NTYPE* nativeptr, bool own )
-          {
-            m_nativeptr = nativeptr;
-            m_own = own;
-          }
-
-          /// <summary>
-          /// Internal cleanup function invoked by dispose/finalizer.
-          /// </summary>
-          inline void InternalCleanup( )
-          {
-            if (m_own && m_nativeptr != nullptr)
-            {
-             // No deletion of m_nativeptr as the destructor is protected or private.
-            }
-          }
-
-        private:
-
-          NTYPE* m_nativeptr;
-          bool m_own;
-        };
-    }  // namespace Client
-  }  // namespace Geode
-}  // namespace Apache
-
-}
-

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxFieldType.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxFieldType.cpp b/src/clicache/src/impl/PdxFieldType.cpp
index 3fe80ee..c319ccd 100644
--- a/src/clicache/src/impl/PdxFieldType.cpp
+++ b/src/clicache/src/impl/PdxFieldType.cpp
@@ -17,7 +17,10 @@
 
 #pragma once
 #include "PdxFieldType.hpp"
+#include "begin_native.hpp"
 #include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
 
 using namespace System;
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxHelper.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxHelper.cpp b/src/clicache/src/impl/PdxHelper.cpp
index 03929b2..1d35467 100644
--- a/src/clicache/src/impl/PdxHelper.cpp
+++ b/src/clicache/src/impl/PdxHelper.cpp
@@ -17,6 +17,12 @@
 
 #pragma once
 
+#include "begin_native.hpp"
+#include <CacheImpl.hpp>
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include "end_native.hpp"
+
 #include "PdxHelper.hpp"
 #include "PdxTypeRegistry.hpp"
 #include "PdxWriterWithTypeCollector.hpp"
@@ -27,9 +33,7 @@
 #include "PdxWrapper.hpp"
 #include "../Log.hpp"
 #include "PdxInstanceImpl.hpp"
-#include <CacheImpl.hpp>
-#include <CacheRegionHelper.hpp>
-#include <geode/Cache.hpp>
+
 using namespace System;
 
 namespace Apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxHelper.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxHelper.hpp b/src/clicache/src/impl/PdxHelper.hpp
index 43d51bb..80b2b80 100644
--- a/src/clicache/src/impl/PdxHelper.hpp
+++ b/src/clicache/src/impl/PdxHelper.hpp
@@ -17,7 +17,10 @@
 
 #pragma once
 //#include "../DataOutput.hpp"
+#include "begin_native.hpp"
 #include <geode/DataOutput.hpp>
+#include "end_native.hpp"
+
 #include "../IPdxSerializable.hpp"
 using namespace System;
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxInstanceImpl.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxInstanceImpl.cpp b/src/clicache/src/impl/PdxInstanceImpl.cpp
index 57027df..b4092f9 100755
--- a/src/clicache/src/impl/PdxInstanceImpl.cpp
+++ b/src/clicache/src/impl/PdxInstanceImpl.cpp
@@ -16,6 +16,13 @@
  */
 
 #pragma once
+
+#include "begin_native.hpp"
+#include <CacheRegionHelper.hpp>
+#include <geode/Cache.hpp>
+#include <CacheImpl.hpp>
+#include "end_native.hpp"
+
 #include "PdxInstanceImpl.hpp"
 #include "PdxHelper.hpp"
 #include "PdxTypeRegistry.hpp"
@@ -24,10 +31,8 @@
 #include "PdxLocalWriter.hpp"
 #include "../DataInput.hpp"
 #include "DotNetTypes.hpp"
-#include <CacheRegionHelper.hpp>
-#include <geode/Cache.hpp>
-#include <CacheImpl.hpp>
 #include "PdxType.hpp"
+
 using namespace System::Text;
 
 namespace Apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.cpp b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
index 003a3f4..81fa5d2 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.cpp
@@ -17,11 +17,15 @@
  */
 
 #pragma once
+
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "PdxManagedCacheableKey.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "ManagedString.hpp"
 #include "PdxHelper.hpp"
@@ -180,7 +184,7 @@ namespace apache
       bool PdxManagedCacheableKey::operator ==(const PdxManagedCacheableKey& other) const
       {
         try {
-          return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.get()));
+          return ((Apache::Geode::Client::IPdxSerializable^)m_managedptr)->Equals((other.ptr()));
         }
         catch (Apache::Geode::Client::GeodeException^ ex) {
           ex->ThrowNative();

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKey.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKey.hpp b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
index 7280539..859319b 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKey.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKey.hpp
@@ -17,13 +17,18 @@
 
 #pragma once
 
-#include "../geode_defs.hpp"
-#include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheableKey.hpp>
+#include <geode/Delta.hpp>
 #include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
+#include "../geode_defs.hpp"
+#include <vcclr.h>
+
 #include "../IPdxSerializable.hpp"
-#include <geode/Delta.hpp>
 #include "../IGeodeDelta.hpp"
+
 using namespace System;
 using namespace apache::geode::client;
 namespace Apache

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
index 5cc34de..cabe7d9 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.cpp
@@ -15,13 +15,15 @@
  * limitations under the License.
  */
 
-//#include "../geode_includes.hpp"
+#include "begin_native.hpp"
+#include <GeodeTypeIdsImpl.hpp>
+#include "end_native.hpp"
+
 #include "PdxManagedCacheableKeyBytes.hpp"
 #include "../DataInput.hpp"
 #include "../DataOutput.hpp"
 #include "../Serializable.hpp"
 #include "../CacheableString.hpp"
-#include <GeodeTypeIdsImpl.hpp>
 #include "../ExceptionTypes.hpp"
 #include "ManagedString.hpp"
 #include "SafeConvert.hpp"
@@ -36,7 +38,7 @@ namespace apache
     {
       void PdxManagedCacheableKeyBytes::toData(apache::geode::client::DataOutput& output) const
       {
-        // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId );
+        // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toData: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId );
         try {
           //TODO: I think this should work as it is
           output.writeBytesOnly(m_bytes, m_size);
@@ -219,7 +221,7 @@ namespace apache
             Apache::Geode::Client::Serializable::GetTypeFactoryMethodGeneric(m_classId)();
             obj->FromData(%mg_input);*/
           Apache::Geode::Client::IPdxSerializable^ obj = getManagedObject();
-          bool ret = obj->Equals(other.get());
+          bool ret = obj->Equals(other.ptr());
           // Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::equal return VAL = " + ret);
           return ret;
           //return obj->Equals(other.get());
@@ -289,7 +291,7 @@ namespace apache
       void PdxManagedCacheableKeyBytes::toDelta(DataOutput& output) const
       {
         try {
-          Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+          Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::toDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
           Apache::Geode::Client::IGeodeDelta^ deltaObj = dynamic_cast<Apache::Geode::Client::IGeodeDelta^>(this->getManagedObject());
           Apache::Geode::Client::DataOutput mg_output(&output, true);
           deltaObj->ToDelta(%mg_output);
@@ -315,7 +317,7 @@ namespace apache
             dynamic_cast <Apache::Geode::Client::IPdxSerializable^> (deltaObj);
           // if(managedptr != nullptr)
           {
-            Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((int)this) + " with its domain ID: " + m_domainId);
+            Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: current domain ID: " + System::Threading::Thread::GetDomainID() + " for object: " + System::Convert::ToString((uint64_t) this) + " with its domain ID: " + m_domainId);
             //Apache::Geode::Client::Log::Debug("PdxManagedCacheableKeyBytes::fromDelta: classid " + managedptr->ClassId + " : " + managedptr->ToString());
             apache::geode::client::DataOutput dataOut;
             Apache::Geode::Client::DataOutput mg_output(&dataOut, true);

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
index 787df4d..f9c1c9f 100644
--- a/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
+++ b/src/clicache/src/impl/PdxManagedCacheableKeyBytes.hpp
@@ -19,11 +19,17 @@
 
 #include "../geode_defs.hpp"
 #include <vcclr.h>
+#include "begin_native.hpp"
 #include <geode/CacheableKey.hpp>
+#include "end_native.hpp"
+
 #include "../Log.hpp"
 #include "../DataOutput.hpp"
 #include "PdxHelper.hpp"
+#include "begin_native.hpp"
 #include <geode/Delta.hpp>
+#include "end_native.hpp"
+
 
 using namespace System;
 
@@ -204,7 +210,7 @@ namespace apache
       Apache::Geode::Client::Log::Fine(
         "ManagedCacheableKeyBytes::Destructor current AppDomain ID: " +
         System::Threading::Thread::GetDomainID() + " for object: " +
-        System::Convert::ToString((int)this) + " with its AppDomain ID: " + m_domainId);
+        System::Convert::ToString((uint64_t) this) + " with its AppDomain ID: " + m_domainId);
       GF_SAFE_DELETE(m_bytes);
     }
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
index 4aa9a21..b6107a5 100644
--- a/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxReaderWithTypeCollector.cpp
@@ -16,7 +16,10 @@
  */
 
 #include "PdxReaderWithTypeCollector.hpp"
+#include "begin_native.hpp"
 #include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
 #include "../GeodeClassIds.hpp"
 using namespace System;
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
index 0c180aa..d95dbf5 100644
--- a/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
+++ b/src/clicache/src/impl/PdxWriterWithTypeCollector.cpp
@@ -17,7 +17,10 @@
 
 #include "PdxWriterWithTypeCollector.hpp"
 #include "../DataOutput.hpp"
+#include "begin_native.hpp"
 #include <geode/GeodeTypeIds.hpp>
+#include "end_native.hpp"
+
 #include "../GeodeClassIds.hpp"
 #include "PdxHelper.hpp"
 

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/PersistenceManagerProxy.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/PersistenceManagerProxy.hpp b/src/clicache/src/impl/PersistenceManagerProxy.hpp
index fbbbb5e..a88d0bd 100644
--- a/src/clicache/src/impl/PersistenceManagerProxy.hpp
+++ b/src/clicache/src/impl/PersistenceManagerProxy.hpp
@@ -64,8 +64,8 @@ namespace Apache
 
             virtual void init(const RegionPtr& region, PropertiesPtr& diskProperties)
             {
-              IRegion<TKey, TValue>^ gRegion = Region<TKey, TValue>::Create(region.get());
-              Properties<String^, String^>^ gProps = Properties<String^, String^>::Create<String^, String^>(diskProperties.get());
+              auto gRegion = Region<TKey, TValue>::Create(region);
+              auto gProps = Properties<String^, String^>::Create(diskProperties);
               m_persistenceManager->Init(gRegion, gProps);
             }
             

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/RegionImpl.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/RegionImpl.hpp b/src/clicache/src/impl/RegionImpl.hpp
index 1eb891f..81d6dda 100644
--- a/src/clicache/src/impl/RegionImpl.hpp
+++ b/src/clicache/src/impl/RegionImpl.hpp
@@ -19,8 +19,11 @@
 
 #include "../geode_defs.hpp"
 #include "../../../IRegion.hpp"
+#include "begin_native.hpp"
 #include <geode/Cache.hpp>
-#include "NativeWrapper.hpp"
+#include "end_native.hpp"
+
+
 //#include "CacheableHashMap.hpp"
 //#include "Log.hpp"
 #include "../ExceptionTypes.hpp"

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/impl/SafeConvert.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/impl/SafeConvert.hpp b/src/clicache/src/impl/SafeConvert.hpp
index 8f8d091..69fe885 100644
--- a/src/clicache/src/impl/SafeConvert.hpp
+++ b/src/clicache/src/impl/SafeConvert.hpp
@@ -18,7 +18,7 @@
 #pragma once
 
 #include "../geode_defs.hpp"
-#include "NativeWrapper.hpp"
+
 #include "ManagedCacheableKey.hpp"
 #include "ManagedCacheableDelta.hpp"
 #include "ManagedCacheableKeyBytes.hpp"
@@ -39,6 +39,7 @@ namespace Apache
   {
     namespace Client
     {
+      namespace native = apache::geode::client;
 
 				interface class IPdxSerializable;
       public ref class SafeConvertClassGeneric
@@ -58,67 +59,47 @@ namespace Apache
       /// to managed <see cref="IGeodeSerializable" /> object.
       /// </summary>
       inline static Apache::Geode::Client::IGeodeSerializable^
-        SafeUMSerializableConvertGeneric( apache::geode::client::Serializable* obj )
+        SafeUMSerializableConvertGeneric(native::SerializablePtr obj)
       {
-
         if (obj == nullptr) return nullptr;
-        
-        apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;          
-        apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;          
 
-        if(!SafeConvertClassGeneric::isAppDomainEnabled)
-          mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
-        else
-          mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
-        apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
-        apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
-        
-        if (mg_obj != nullptr)
-        {
-          return mg_obj->ptr( );
-        }
-        else if(mg_bytesObj != nullptr)
-        {
-          return mg_bytesObj->ptr();
-        }
-        else
+        if (SafeConvertClassGeneric::isAppDomainEnabled)
         {
-          if(!SafeConvertClassGeneric::isAppDomainEnabled)
-            mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
-          else
-            mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
-          
-          if( mg_obj_delta != nullptr )
+          if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
           {
-            return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr( ));
+            return mg_bytesObj->ptr();
           }
-          else if(mg_bytesObj_delta != nullptr)
+          if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
           {
-            return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_bytesObj_delta->ptr( ));
+            return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_bytesObj_delta->ptr());
           }
-          else
+        }
+        else {
+          if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
           {
-            if ( obj->typeId( ) == 0 ) {
-              //Special case for UserFunctionExecutionException which is not registered.
-              apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
-              mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );
-              if (mg_UFEEobj != nullptr) 
-              {              
-                return gcnew UserFunctionExecutionException(mg_UFEEobj);              
-              }
-            }
-
-            WrapperDelegateGeneric^ wrapperMethod =
-              Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
-            if (wrapperMethod != nullptr)
-            {
-              return wrapperMethod( obj );
-            }            
+            return mg_obj->ptr();
+          }
+          if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+          {
+            return dynamic_cast<Apache::Geode::Client::IGeodeSerializable^>(mg_obj_delta->ptr());
+          }
+        }
 
-            return gcnew Apache::Geode::Client::Serializable( obj );
+        if (obj->typeId() == 0)
+        {
+          if (auto mg_UFEEobj = std::dynamic_pointer_cast<native::UserFunctionExecutionException>(obj))
+          {
+            return gcnew UserFunctionExecutionException(mg_UFEEobj);
           }
         }
+
+        auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );             
+        if (wrapperMethod != nullptr)
+        {
+          return wrapperMethod( obj );
+        }
+
+        return gcnew Apache::Geode::Client::Serializable( obj );
       }
 
       /// <summary>
@@ -127,7 +108,7 @@ namespace Apache
       /// <remarks>
       /// <para>
       /// Consider the scenario that we have both native objects of class
-      /// <c>apache::geode::client::Serializable</c> and managed objects of class
+      /// <c>native::Serializable</c> and managed objects of class
       /// <see cref="IGeodeSerializable" /> in a Region.
       /// </para><para>
       /// The former would be passed wrapped inside the
@@ -149,8 +130,8 @@ namespace Apache
       inline static NativeType* SafeM2UMConvertGeneric( ManagedType^ mg_obj )
       {
         /*
-        *return SafeM2UMConvertGeneric<IGeodeSerializable, apache::geode::client::ManagedCacheableKey,
-          apache::geode::client::Serializable, Serializable>( mg_obj );
+        *return SafeM2UMConvertGeneric<IGeodeSerializable, native::ManagedCacheableKey,
+          native::Serializable, Serializable>( mg_obj );
         */
         //TODO: need to look this further for all types
         if (mg_obj == nullptr) return NULL;
@@ -168,15 +149,15 @@ namespace Apache
             dynamic_cast<Apache::Geode::Client::IGeodeDelta^> (mg_obj);
           if(sDelta != nullptr){
             if(!SafeConvertClassGeneric::isAppDomainEnabled)
-              return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
+              return new native::ManagedCacheableDeltaGeneric( sDelta);
             else
-              return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+              return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
           }
           else{
             if(!SafeConvertClassGeneric::isAppDomainEnabled)
               return new ManagedWrapper(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
             else
-              return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true);
+              return new native::ManagedCacheableKeyBytesGeneric( mg_obj, true);
           }
         }
          //if (mg_obj == nullptr) return NULL;
@@ -190,83 +171,66 @@ namespace Apache
       }
 
       generic<class TValue>
-      inline static TValue SafeGenericUMSerializableConvert( apache::geode::client::Serializable* obj )
+      inline static TValue SafeGenericUMSerializableConvert( native::SerializablePtr obj )
       {
 
         if (obj == nullptr) return TValue();
         
-        apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;          
-        apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;          
-
-        if(!SafeConvertClassGeneric::isAppDomainEnabled)
-          mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
-        else
-          mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
-        apache::geode::client::ManagedCacheableDeltaGeneric* mg_obj_delta = nullptr;
-        apache::geode::client::ManagedCacheableDeltaBytesGeneric* mg_bytesObj_delta = nullptr;
-        
-        if (mg_obj != nullptr)
-        {
-          return (TValue)mg_obj->ptr( );
-        }
-        else if(mg_bytesObj != nullptr)
-        {
-          return (TValue)mg_bytesObj->ptr();
-        }
-        else
+        if (SafeConvertClassGeneric::isAppDomainEnabled)
         {
-          if(!SafeConvertClassGeneric::isAppDomainEnabled)
-            mg_obj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaGeneric*>( obj );
-          else
-            mg_bytesObj_delta = dynamic_cast<apache::geode::client::ManagedCacheableDeltaBytesGeneric*>( obj );
-          
-          if( mg_obj_delta != nullptr )
+          if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
           {
-            return safe_cast<TValue>(mg_obj_delta->ptr( ));
+            return (TValue)mg_bytesObj->ptr();
           }
-          else if(mg_bytesObj_delta != nullptr)
+          if (auto mg_bytesObj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaBytesGeneric>(obj))
           {
-            return safe_cast<TValue>(mg_bytesObj_delta->ptr( ));
+            return safe_cast<TValue>(mg_bytesObj_delta->ptr());
+          }
+        } else {
+          if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
+          {
+            return (TValue)mg_obj->ptr();
           }
-          else
-          {            
-            if ( obj->typeId( ) == 0 ) {
-              apache::geode::client::UserFunctionExecutionException* mg_UFEEobj = nullptr;
-              mg_UFEEobj = dynamic_cast<apache::geode::client::UserFunctionExecutionException*>( obj );              
-              if (mg_UFEEobj != nullptr) 
-              {                
-                return safe_cast<TValue> (gcnew UserFunctionExecutionException(mg_UFEEobj));              
-              }
-            }
 
-            WrapperDelegateGeneric^ wrapperMethod =
-              Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );             
-            if (wrapperMethod != nullptr)
-            {
-              return safe_cast<TValue>(wrapperMethod( obj ));
-            }
-            return safe_cast<TValue>(gcnew Apache::Geode::Client::Serializable( obj ));
+          if (auto mg_obj_delta = std::dynamic_pointer_cast<native::ManagedCacheableDeltaGeneric>(obj))
+          {
+            return safe_cast<TValue>(mg_obj_delta->ptr());
+          }
+        }
+
+        if (obj->typeId() == 0)
+        {
+          if (auto mg_UFEEobj = std::dynamic_pointer_cast<native::UserFunctionExecutionException>(obj))
+          {
+            return safe_cast<TValue> (gcnew UserFunctionExecutionException(mg_UFEEobj));
           }
         }
+
+        auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );             
+        if (wrapperMethod != nullptr)
+        {
+          return safe_cast<TValue>(wrapperMethod( obj ));
+        }
+
+        return safe_cast<TValue>(gcnew Apache::Geode::Client::Serializable( obj ));
       }
 
       /// <summary>
       /// Helper function to convert managed <see cref="IGeodeSerializable" />
-      /// object to native <c>apache::geode::client::Serializable</c> object using
+      /// object to native <c>native::Serializable</c> object using
       /// <c>SafeM2UMConvert</c>.
       /// </summary>
-      inline static apache::geode::client::Serializable* SafeMSerializableConvertGeneric(
+      inline static native::Serializable* SafeMSerializableConvertGeneric(
         Apache::Geode::Client::IGeodeSerializable^ mg_obj )
       {
         //it is called for cacheables types  only
         return SafeM2UMConvertGeneric<Apache::Geode::Client::IGeodeSerializable,
-          apache::geode::client::ManagedCacheableKeyGeneric, apache::geode::client::Serializable,
+          native::ManagedCacheableKeyGeneric, native::Serializable,
           Apache::Geode::Client::Serializable>( mg_obj );
       }
 
       generic<class TValue>
-      inline static apache::geode::client::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
+      inline static native::Cacheable* SafeGenericM2UMConvert( TValue mg_val )
       {
         if (mg_val == nullptr) return NULL;
 
@@ -288,9 +252,9 @@ namespace Apache
         {
           //TODO:: probably need to do for appdomain
 					if(!SafeConvertClassGeneric::isAppDomainEnabled)
-						return new apache::geode::client::PdxManagedCacheableKey(pdxType);
+						return new native::PdxManagedCacheableKey(pdxType);
 					else
-						return new apache::geode::client::PdxManagedCacheableKeyBytes(pdxType, true);
+						return new native::PdxManagedCacheableKeyBytes(pdxType, true);
         }
       
 				Apache::Geode::Client::IGeodeDelta^ sDelta =
@@ -298,9 +262,9 @@ namespace Apache
           if(sDelta != nullptr)
 					{
             if(!SafeConvertClassGeneric::isAppDomainEnabled)
-              return new apache::geode::client::ManagedCacheableDeltaGeneric( sDelta);
+              return new native::ManagedCacheableDeltaGeneric( sDelta);
             else
-              return new apache::geode::client::ManagedCacheableDeltaBytesGeneric( sDelta, true);
+              return new native::ManagedCacheableDeltaBytesGeneric( sDelta, true);
           }
           else
 					{
@@ -310,11 +274,11 @@ namespace Apache
 						{
 							if(!SafeConvertClassGeneric::isAppDomainEnabled)
 							{
-									return new apache::geode::client::ManagedCacheableKeyGeneric( tmpIGFS );
+									return new native::ManagedCacheableKeyGeneric( tmpIGFS );
 							}
 							else
 							{
-								return new apache::geode::client::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
+								return new native::ManagedCacheableKeyBytesGeneric( tmpIGFS, true);
 							}
 						}
             
@@ -322,89 +286,76 @@ namespace Apache
             {
               //TODO:: probably need to do for appdomain
 					    if(!SafeConvertClassGeneric::isAppDomainEnabled)
-					    	return new apache::geode::client::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
+					    	return new native::PdxManagedCacheableKey(gcnew PdxWrapper(mg_obj));
 					    else
-						    return new apache::geode::client::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
+						    return new native::PdxManagedCacheableKeyBytes(gcnew PdxWrapper(mg_obj), true);
             }
             throw gcnew Apache::Geode::Client::IllegalStateException(String::Format("Unable to map object type {0}. Possible Object type may not be registered or PdxSerializer is not registered. ", mg_obj->GetType()));
           }	
       }
 
       generic<class TValue>
-      inline static apache::geode::client::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
+      inline static native::Cacheable* SafeGenericMSerializableConvert( TValue mg_obj )
       {
         return SafeGenericM2UMConvert<TValue>( mg_obj );
       }
 
-			inline static IPdxSerializable^ SafeUMSerializablePDXConvert( apache::geode::client::Serializable* obj )
+			inline static IPdxSerializable^ SafeUMSerializablePDXConvert( native::SerializablePtr obj )
       {
-        apache::geode::client::PdxManagedCacheableKey* mg_obj = nullptr; 
-
-         mg_obj = dynamic_cast<apache::geode::client::PdxManagedCacheableKey*>( obj );
-
-         if(mg_obj != nullptr)
+         if(auto mg_obj = std::dynamic_pointer_cast<native::PdxManagedCacheableKey>( obj ))
            return mg_obj->ptr();
 
-				 apache::geode::client::PdxManagedCacheableKeyBytes* mg_bytes = dynamic_cast<apache::geode::client::PdxManagedCacheableKeyBytes*>( obj );
-
-				 if(mg_bytes != nullptr)
+				 if(auto mg_bytes = std::dynamic_pointer_cast<native::PdxManagedCacheableKeyBytes>( obj ))
            return mg_bytes->ptr();
 
          throw gcnew IllegalStateException("Not be able to deserialize managed type");
       }
 
       /// <summary>
-      /// Helper function to convert native <c>apache::geode::client::CacheableKey</c> object
+      /// Helper function to convert native <c>native::CacheableKey</c> object
       /// to managed <see cref="ICacheableKey" /> object.
       /// </summary>
       generic<class TKey>
-      inline static Client::ICacheableKey^ SafeGenericUMKeyConvert( apache::geode::client::CacheableKey* obj )
+      inline static Client::ICacheableKey^ SafeGenericUMKeyConvert( native::CacheableKeyPtr obj )
       {
         //All cacheables will be ManagedCacheableKey only
         if (obj == nullptr) return nullptr;
-        apache::geode::client::ManagedCacheableKeyGeneric* mg_obj = nullptr;
-        apache::geode::client::ManagedCacheableKeyBytesGeneric* mg_bytesObj = nullptr;
-
-        if (!SafeConvertClassGeneric::isAppDomainEnabled)
-          mg_obj = dynamic_cast<apache::geode::client::ManagedCacheableKeyGeneric*>( obj );
-        else
-          mg_bytesObj = dynamic_cast<apache::geode::client::ManagedCacheableKeyBytesGeneric*>( obj );
-
-        if (mg_obj != nullptr)
+ 
+        if (SafeConvertClassGeneric::isAppDomainEnabled)
         {
-          return (Client::ICacheableKey^)mg_obj->ptr( );
+          if (auto mg_bytesObj = std::dynamic_pointer_cast<native::ManagedCacheableKeyBytesGeneric>(obj))
+          {
+            return (Client::ICacheableKey^)mg_bytesObj->ptr( );
+          }
         }
-        else if(mg_bytesObj != nullptr)
+        if (auto mg_obj = std::dynamic_pointer_cast<native::ManagedCacheableKeyGeneric>(obj))
         {
-          return (Client::ICacheableKey^)mg_bytesObj->ptr( );
+            return (Client::ICacheableKey^)mg_obj->ptr( );
         }
-        else
+
+        auto wrapperMethod = Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
+        if (wrapperMethod != nullptr)
         {
-          WrapperDelegateGeneric^ wrapperMethod =
-            Apache::Geode::Client::Serializable::GetWrapperGeneric( obj->typeId( ) );
-          if (wrapperMethod != nullptr)
-          {
-            return (Client::ICacheableKey^)wrapperMethod( obj );
-          }
-          return gcnew Client::CacheableKey( obj );
+          return (Client::ICacheableKey^)wrapperMethod( obj );
         }
+        return gcnew Client::CacheableKey( obj );
       }
 
       generic <class TKey>
-      inline static apache::geode::client::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
+      inline static native::CacheableKey* SafeGenericMKeyConvert( TKey mg_obj )
       {
         if (mg_obj == nullptr) return NULL;
-        apache::geode::client::CacheableKey* obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj ).get();
-        if (obj != nullptr)
+        auto obj = Apache::Geode::Client::Serializable::GetUnmanagedValueGeneric<TKey>( mg_obj );
+        if (obj.get() != nullptr)
         {
-          return obj;
+          return obj.get();
         }
         else
         {
           if(!SafeConvertClassGeneric::isAppDomainEnabled)
-            return new apache::geode::client::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
+            return new native::ManagedCacheableKeyGeneric( SafeUMSerializableConvertGeneric(obj) );
           else
-            return new apache::geode::client::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
+            return new native::ManagedCacheableKeyBytesGeneric( SafeUMSerializableConvertGeneric(obj), true );
         }
       }
 
@@ -413,41 +364,16 @@ namespace Apache
       {
         if (mg_obj == nullptr) return NULL;
         //for cacheables types
-        //return new apache::geode::client::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
+        //return new native::ManagedCacheableKey(mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId);
         {
           if(!SafeConvertClassGeneric::isAppDomainEnabled)
-            return new apache::geode::client::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
+            return new native::ManagedCacheableKeyGeneric( mg_obj, mg_obj->GetHashCode(), mg_obj->ClassId );
           else
-            return new apache::geode::client::ManagedCacheableKeyBytesGeneric( mg_obj, true );
+            return new native::ManagedCacheableKeyBytesGeneric( mg_obj, true );
         }
       }
 
-      template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
-      //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
-      inline static NativeType* GetNativePtrFromSBWrap( Apache::Geode::Client::Internal::SBWrap<NativeType>^ mg_obj )
-      {
-        return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
-      }
-
-			 template<typename NativeType> //where NativeType : apache::geode::client::SharedPtr<NativeType>
-      //generic<typename ManagedType> where ManagedType : Internal::SBWrap<apache::geode::client::RegionAttributes>
-			 inline static NativeType* GetNativePtrFromSBWrapGeneric( Apache::Geode::Client::Internal::SBWrap<NativeType>^ mg_obj )
-      {
-        return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
-      }
-
-      template<typename NativeType>
-      inline static NativeType* GetNativePtrFromUMWrap( Apache::Geode::Client::Internal::UMWrap<NativeType>^ mg_obj )
-      {
-        return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
-      }
-
-			template<typename NativeType>
-			inline static NativeType* GetNativePtrFromUMWrapGeneric( Apache::Geode::Client::Internal::UMWrap<NativeType>^ mg_obj )
-      {
-        return (mg_obj != nullptr ? mg_obj->_NativePtr : NULL);
     }  // namespace Client
   }  // namespace Geode
 }  // namespace Apache
 
-}

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_conditional_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_conditional_unique_ptr.hpp b/src/clicache/src/native_conditional_unique_ptr.hpp
new file mode 100644
index 0000000..aff0b47
--- /dev/null
+++ b/src/clicache/src/native_conditional_unique_ptr.hpp
@@ -0,0 +1,42 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      template <class _T>
+      public ref class native_conditional_unique_ptr sealed {
+      private:
+        std::unique_ptr<_T>* owned_ptr;
+        _T* unowned_ptr;
+
+      public:
+        native_conditional_unique_ptr(std::unique_ptr<_T> ptr) :
+          owned_ptr(new std::unique_ptr<_T>(std::move(ptr))), 
+          unowned_ptr(__nullptr) {}
+
+        native_conditional_unique_ptr(_T* ptr) :
+          owned_ptr(__nullptr),
+          unowned_ptr(ptr) {}
+
+        ~native_conditional_unique_ptr() {
+          native_conditional_unique_ptr::!native_conditional_unique_ptr();
+        }
+
+        !native_conditional_unique_ptr() {
+          delete owned_ptr;
+        }
+
+        inline _T* get() {
+          return __nullptr == owned_ptr ? unowned_ptr : owned_ptr->get();
+        }
+
+      };
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_shared_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_shared_ptr.hpp b/src/clicache/src/native_shared_ptr.hpp
new file mode 100644
index 0000000..0e40ff9
--- /dev/null
+++ b/src/clicache/src/native_shared_ptr.hpp
@@ -0,0 +1,39 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      template <class _T>
+      public ref class native_shared_ptr sealed {
+      private:
+        std::shared_ptr<_T>* ptr;
+
+      public:
+        native_shared_ptr(const std::shared_ptr<_T>& ptr) : ptr(new std::shared_ptr<_T>(ptr)) {}
+
+        ~native_shared_ptr() {
+          native_shared_ptr::!native_shared_ptr();
+        }
+
+        !native_shared_ptr() {
+          delete ptr;
+        }
+
+        inline _T* get() {
+          return ptr->get();
+        }
+
+        inline std::shared_ptr<_T> get_shared_ptr() {
+          return *ptr;
+        }
+
+      };
+    }
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/src/native_unique_ptr.hpp
----------------------------------------------------------------------
diff --git a/src/clicache/src/native_unique_ptr.hpp b/src/clicache/src/native_unique_ptr.hpp
new file mode 100644
index 0000000..bd8ff5f
--- /dev/null
+++ b/src/clicache/src/native_unique_ptr.hpp
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <memory>
+
+namespace Apache
+{
+  namespace Geode
+  {
+    namespace Client
+    {
+
+      template <class _T>
+      public ref class native_unique_ptr sealed {
+      private:
+        std::unique_ptr<_T>* ptr;
+
+      public:
+        native_unique_ptr(std::unique_ptr<_T> ptr) : ptr(new std::unique_ptr<_T>(std::move(ptr))) {}
+
+        ~native_unique_ptr() {
+          native_unique_ptr::!native_unique_ptr();
+        }
+
+        !native_unique_ptr() {
+          delete ptr;
+        }
+
+        inline _T* get() {
+          return ptr->get();
+        }
+
+      };
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/geode-native/blob/6027574a/src/clicache/test/AssemblyInfo.cpp.in
----------------------------------------------------------------------
diff --git a/src/clicache/test/AssemblyInfo.cpp.in b/src/clicache/test/AssemblyInfo.cpp.in
new file mode 100644
index 0000000..e3bbb9e
--- /dev/null
+++ b/src/clicache/test/AssemblyInfo.cpp.in
@@ -0,0 +1,32 @@
+using namespace System::Reflection;
+using namespace System::Runtime::CompilerServices;
+using namespace System::Runtime::InteropServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+//
+[assembly:AssemblyTitleAttribute("cliunittests")];
+[assembly:AssemblyDescriptionAttribute("")];
+[assembly:AssemblyConfigurationAttribute("")];
+[assembly:AssemblyCompanyAttribute("")];
+[assembly:AssemblyProductAttribute("cliunittests")];
+[assembly:AssemblyCopyrightAttribute("Copyright (c)  2017")];
+[assembly:AssemblyTrademarkAttribute("")];
+[assembly:AssemblyCultureAttribute("")];
+
+//
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version
+//      Build Number
+//      Revision
+//
+// You can specify all the value or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+
+[assembly:AssemblyVersionAttribute("1.0.*")];
+[assembly:ComVisible(false)];
+