Reputation: 41
I am working in a WPF based app, and I would like to use Realm as a DB engine for a specific part of the project. I tried installing the packages via Nuget, but for some reason it appears to fail. I believe the problem seems to be related to using .NET Framework instead of newer .NET. Am I right? Is Realm incompatible with .NET Framework 4.8.1?
Update:
Here are the errors after i create a class using IRealmObject
interface:
Using latest Realm installed via Nuget and .NET FW 4.8.1
Thanks
Upvotes: 0
Views: 213
Reputation: 38
In Realm you have two approaches.
The Errors shown in the original question are raised probably because the class implementing the IRealmObject is not partial and the source generation of realm fails then. Example for implementing IRealmObject correctly:
public partial class Exercise : IRealmObject, IEntity<ObjectId>
{
[PrimaryKey]
[MapTo("_id")]
public ObjectId Id { get; set; } = ObjectId.GenerateNewId();
[MapTo("partition")]
public string Partition { get; set; } = string.Empty;
}
( IEntity is custom interface that gets implemented)
Upvotes: 1
Reputation: 41
So,
Basically I have an Interface ICalibration, where that interface implements IRealmObject, and my error was in the implementation of such interface. You have to implement RealmObject and latter the ICalibration:
interface ICalibration : IRealmObject { ... }
partial class DualLinearRegressionCalibration : RealmObject, ICalibration {...}
Upvotes: 0