urfnet / URF.Core

Unit of Work & Repositories Framework - .NET Core, NET Standard, Entity Framework Core. 100% extensible & lightweight.
https://github.com/urfnet
MIT License
309 stars 62 forks source link

Insert called even in update and delete methods #21

Closed noufionline closed 6 years ago

noufionline commented 6 years ago

Hi there,

I am a bit confused here.

In your repository code

 public virtual void Insert(TEntity item)
            => Context.Entry(item).State = EntityState.Added;

and at the same time in the Trackable Code


 public override void Insert(TEntity item)
        {
            item.TrackingState = TrackingState.Added;
            base.Insert(item);
        }

        public override void Update(TEntity item)
        {
            item.TrackingState = TrackingState.Modified;
            base.Insert(item);
        }

        public override void Delete(TEntity item)
        {
            item.TrackingState = TrackingState.Deleted;
            base.Insert(item);
        }

Even for Delete and Update methods Insert is called.

celestialtek commented 6 years ago

Oh, I had to clone and modified these code, I think author copy & paste in code 💃. Please Fix in source with match methods

lelong37 commented 6 years ago

There was a PR that issued with a minor refactor, and there was a bug that was introduced during the merge, this has been hot-fixed, released and URF.Core NuGet Packages RC1 has been released with the hot-fix and live demo has been redployed with RC1 bits.