Skip to content

Commit

Permalink
Merge pull request #14 from sushihangover/1.1.2
Browse files Browse the repository at this point in the history
Update to Realm 0.81.0
  • Loading branch information
sushihangover authored Jan 21, 2017
2 parents 220d817 + 53cb2bf commit 1d3c719
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 11 deletions.
17 changes: 17 additions & 0 deletions src/Nuget.Test/Droid/Linker.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<linker>
<assembly fullname="RealmJson.Extensions">
<type fullname="Realms.RealmObject">
<method signature="Realms.RealmObject Realms.Realm::ObjectForPrimaryKey(System.String,System.Nullable`1<System.Int64>)" />
</type>
</assembly>
</linker>

<!--
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets:
Error: Error executing task LinkAssemblies: error XA2006:
Could not resolve reference to
'Realms.RealmObject Realms.Realm::ObjectForPrimaryKey(System.String,System.Nullable`1<System.Int64>)'
(defined in assembly 'RealmJson.Extensions, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null')
with scope 'Realm, Version=0.80.0.0, Culture=neutral, PublicKeyToken=null'.
When the scope is different from the defining assembly, it usually means that the type is forwarded. (Nuget.Test.Droid)
-->
2 changes: 1 addition & 1 deletion src/RealmJson.Extensions.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<licenseUrl>https://github.com/sushihangover/Realm.Json.Extensions</licenseUrl>
<tags>Realm Xamarin Json Netwonsoft SushiHangover</tags>
<dependencies>
<dependency id="Realm" version="0.80.0" />
<dependency id="Realm" version="0.81.0" />
<dependency id="AutoMapper" version="5.1.1" />
<dependency id="Newtonsoft.Json" version="9.0.0" />
</dependencies>
Expand Down
13 changes: 7 additions & 6 deletions src/RealmJson.Extensions/Extension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public static class RealmDoesJson
/// <returns></returns>
/// <param name="realm">Realm Instance</param>
/// <param name="jsonString">Json string</param>
/// <param name="inTransaction">bool.</param>
/// <typeparam name="T">RealmOject-based Class..</typeparam>
public static T CreateObjectFromJson<T>(this Realm realm, string jsonString, bool inTransaction = false) where T : RealmObject
{
Expand Down Expand Up @@ -134,7 +135,7 @@ public static void CreateAllFromJson<T>(this Realm realm, string jsonString, boo
/// </summary>
/// <param name="realm">Realm Instance.</param>
/// <param name="stream">Stream.</param>
/// <param name="updateExistingRecords">bool.</param>
/// <param name="inTransaction">bool.</param>
/// <typeparam name="T">RealmObject-based Class.</typeparam>
public static void CreateAllFromJsonViaAutoMapper<T>(this Realm realm, Stream stream, bool inTransaction = false) where T : RealmObject
{
Expand Down Expand Up @@ -192,7 +193,7 @@ static void CreateUpdateRecordsViaAutoMapper<T>(Realm realm, PropertyInfo pkProp
{
realmObject = (T)Activator.CreateInstance(typeof(T));
newMapper.Map<T, T>(jsonObject, realmObject);
realm.Manage(realmObject, true);
realm.Add(realmObject, true);
}
else
{
Expand Down Expand Up @@ -228,13 +229,13 @@ static T CreateObject<T>(Realm realm, T realmObject, bool updateRecord, bool inT
{
if (inTransaction)
{
realm.Manage(realmObject, updateRecord);
realm.Add(realmObject, updateRecord);
}
else
{
realm.Write(() =>
{
realm.Manage(realmObject, updateRecord);
realm.Add(realmObject, updateRecord);
});
}
return realmObject;
Expand Down Expand Up @@ -272,9 +273,9 @@ static RealmObject FindByPKDynamic(Realm realm, Type type, object primaryKeyValu
{
castPKValue = Convert.ToInt64(primaryKeyValue);
}
return realm.ObjectForPrimaryKey(type.Name, (long)castPKValue);
return realm.Find(type.Name, (long)castPKValue);
}
return realm.ObjectForPrimaryKey(type.Name, (string)primaryKeyValue);
return realm.Find(type.Name, (string)primaryKeyValue);
}

//void createOrUpdateAllFromJson(Class<E> clazz, InputStream in)
Expand Down
16 changes: 14 additions & 2 deletions src/RealmJson.Extensions/SushiHangover.RealmJson.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\RealmJson.Extensions.xml</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NugetTest|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\NugetTest</OutputPath>
<WarningLevel>4</WarningLevel>
<AssemblyName>SushiHangover.RealmJson</AssemblyName>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'NugetRelease|AnyCPU' ">
<Optimize>false</Optimize>
<OutputPath>bin\NugetRelease</OutputPath>
<WarningLevel>4</WarningLevel>
<AssemblyName>SushiHangover.RealmJson</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="Extension.cs" />
<Compile Include="..\CommonAssemblyInfo.cs">
Expand All @@ -49,7 +61,7 @@
<HintPath>..\packages\Remotion.Linq.2.1.1\lib\portable-net45+win+wpa81+wp80\Remotion.Linq.dll</HintPath>
</Reference>
<Reference Include="Realm">
<HintPath>..\packages\Realm.0.80.0\lib\portable-net45+sl5+wp8+wpa81+win8+monoandroid+Xamarin.iOS10+monotouch+Xamarin.Mac\Realm.dll</HintPath>
<HintPath>..\packages\Realm.0.81.0\lib\portable-net45+sl5+wp8+wpa81+win8+monoandroid+Xamarin.iOS10+monotouch+Xamarin.Mac\Realm.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
Expand All @@ -62,5 +74,5 @@
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<Import Project="..\.nuget\NuGet.targets" Condition="Exists('..\.nuget\NuGet.targets')" />
<Import Project="..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets" Condition="Exists('..\packages\Fody.1.29.4\build\portable-net+sl+win+wpa+wp\Fody.targets')" />
<Import Project="..\packages\Realm.0.80.0\build\Realm.targets" Condition="Exists('..\packages\Realm.0.80.0\build\Realm.targets')" />
<Import Project="..\packages\Realm.0.81.0\build\Realm.targets" Condition="Exists('..\packages\Realm.0.81.0\build\Realm.targets')" />
</Project>
2 changes: 1 addition & 1 deletion src/RealmJson.Extensions/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="DotNetCross.Memory.Unsafe" version="0.2.2" targetFramework="portable45-net45+win8+wpa81" />
<package id="Fody" version="1.29.4" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
<package id="Newtonsoft.Json" version="9.0.2-beta1" targetFramework="portable45-net45+win8+wpa81" />
<package id="Realm" version="0.80.0" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
<package id="Realm" version="0.81.0" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
<package id="Remotion.Linq" version="2.1.1" targetFramework="portable45-net45+win8+wpa81" />
<package id="System.Collections" version="4.0.11" targetFramework="portable45-net45+win8+wpa81" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="portable45-net45+win8+wpa81" />
Expand Down
2 changes: 1 addition & 1 deletion src/RealmJson.Shared.Tests/Tests.Shared.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void CreateObjectFromJson_InTransaction_RollBack_Stream()
theRealm.CreateObjectFromJson<StateUnique>(stream, inTransaction: true);
transaction.Rollback();
}
Assert.IsTrue(theRealm.ObjectForPrimaryKey<StateUnique>("AL") == null);
Assert.IsTrue(theRealm.Find<StateUnique>("AL") == null);
}
}

Expand Down

0 comments on commit 1d3c719

Please sign in to comment.