I
I
Ivan Filatov2018-11-22 16:18:19
.NET
Ivan Filatov, 2018-11-22 16:18:19

How to implement change tracking in linq2db?

There is a repository that can pull and save. At the same time, Save for a new object does Insert; for an existing Update

public interface IMyRepository
{
    MyClass Get(Guid id);
    void Save(MyClass myclass);
}

How to implement this using linq2db ? How to track an object?
Used to use EF - it was easy there, EF supports tracking out of the box.
What about linq2db ? Create some DbContext abstraction and keep information about it there?
Share your experience of using linq2db

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Glebov, 2018-11-29
@GLeBaTi

If I'm not mistaken, then linq2db is a microOrm that can only do mapping and generate queries.
Tracking is not there, because not everyone needs it and affects performance.
Usually only heavyweight ORMs like EF or Nhibernate have tracking.
Therefore, either you will have to write it yourself, or not use tracking at all (ie, divide Save into Insert + Update).
For example, I don't use it. Even in EF I turned it off for optimization.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question