I am building a MySQL to Realmdb converter app.

I use Entity Framework to deal with MySQL, so below is the code of one of my model classes. I don't want to have multiple classes representing the same object, so instead of creating separate models for EF and Realm, I am using same model for both ORM's.

The question is, is there any way to improve it, make cleaner and neat, because I don't like putting [Key] for EF and then [PrimaryKey] for Realm and the same with [Index] and [Indexed]. Also does it affect the performance of reading/writing (having support for both ORM's in one model)

using Google.Protobuf.WellKnownTypes;
using MySql.Data.EntityFrameworkCore.DataAnnotations;
using Realms;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Text;

namespace Shared.Models
    public class Phrase : RealmObject
        public int Id { get; set; }

        public int EntryId { get; set; }

        public string Content { get; set; }

        public string Notes { get; set; }

        public string CreatedAt { get; set; }

        public string UpdatedAt { get; set; }


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.