0

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:

enter image description here

Using latest Realm installed via Nuget and .NET FW 4.8.1

Thanks

ppusiol
  • 41
  • 2
  • 1
    The SDK has `netstandard2.0` as TargetFramework. This means that's compatible with .NET framework starting from 4.6.1. We do report as much in our [Platform and Framework Compatibility - .NET SDK](https://www.mongodb.com/docs/realm/sdk/dotnet/compatibility/#std-label-dotnet-compatibility). To get more help you should just post the error that you get. Additionally, you may want to use our forum for troubleshooting as SO makes it a little hard because of its non-forum-like structure. – Andrea Catalini Feb 14 '23 at 10:08
  • Hi Andrea, Thanks. Errors I get are for not implementing part of the Realm Object Interface, such as: 'DualLinearRegressionCalibration' does not implement interface member 'IRealmObjectBase.Accessor', Specifically: Accessor IsManaged IsValid IsFrozen Realm ObjectSchema DynamicApi BacklinksCount and method SetManagedAccessor The object is set to be a partial class. – ppusiol Feb 14 '23 at 14:22
  • Silly rookie mistake, I was inheriting from IRealmObject instead of RealmObject – ppusiol Feb 14 '23 at 22:15

1 Answers1

0

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 {...}

ppusiol
  • 41
  • 2
  • 1
    Hi, you can't do it this way. It's either inheriting from `RealmObject` or implementing `IRealmObject`. Unfortunately, the interface based approach has been only recently introduced and the documentation hasn't caught up yet. However, we made a lengthy description in our [changelog](https://github.com/realm/realm-dotnet/blob/main/CHANGELOG.md#enhancements-3). If after reading that you still have questions, let me know. – Andrea Catalini Feb 15 '23 at 10:51