Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling local cache in Repository #25

Closed
fruex opened this issue Apr 6, 2018 · 2 comments
Closed

Handling local cache in Repository #25

fruex opened this issue Apr 6, 2018 · 2 comments

Comments

@fruex
Copy link

fruex commented Apr 6, 2018

Hello,

I do not have the opportunity to ask something here.
But I wanted to know how you solved the problem with reading the Local for Set collection from the context as a issue.

I am using the previous version of the framework (based on EF 6.1.3), where I expanded the Set with the Local() method, in which I can check whether a given entity with the Identity key has already been created.

My problem came from the warehouse economy where individual items of the document transfer goods between warehouses. The commodity which is transferred to the new warehouse has a new resource (entity) created, which is created appropriately for each item.

However, you can choose the same item in two items, which will be double-opened (I want to avoid this situation). In this case, when I process the first document line I create the object, and in the second document position I want to refer to the local memory and read it. When I find the appropriate object, I will be able to update the amount of +=. If I do not find this object then I will want to create it respectively.

Reference to file https://github.com/urfnet/URF.Core/blob/master/URF.Core.EF/Repository.cs

@lelong37
Copy link
Member

lelong37 commented Apr 8, 2018

Hi @fruex , could you be so kind to submit a PR adding a unit test (possibly to: https://github.com/urfnet/URF.Core/blob/master/URF.Core.EF.Tests/RepositoryTest.cs) that asserts your specific use case? Sounds like distinguishing between local instance and possibly handling an "upsert" scenario? If you need to submit the PR with the unit test failing that's fine, again, this way we can understand the exact use case your trying to implement, thanks!

@lelong37
Copy link
Member

Closing due to no response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants