Coder Social home page Coder Social logo

Comments (4)

FlyingDR avatar FlyingDR commented on August 18, 2024 2

Maybe it will be worth having an option to choose to clear UnitOfWork contents or not (e.g. via separate property), so library users will at least have control over this aspect? It may default to not clear to keep current behavior intact. It may also have an explanation of its meaning and reasons for its existence as a comment so it will be easier to understand.

At the very minimum, it needs to be mentioned in the documentation that the identity map in UnitOfWork is not empty by the time of the start of the test and that it may affect the behavior of the tested application. It took me several hours to find out the reason for the test failure which was caused by current behavior, so at least knowing about this aspect is practical.

from alicebundle.

theofidry avatar theofidry commented on August 18, 2024

I am not sure this can be changed. IIRC there was in the past an attempt made there, but I had to revert it because it was breaking too many things.

Indeed you can get the objects from the loader in your tests in which case you want persisted objects. If you do the clear you will end up with objects you will have to persist manually

from alicebundle.

boonkerz avatar boonkerz commented on August 18, 2024

yea because with a lot of releations the entitys does not filled up correctly.

i run into this issue: the roles doesn't load into the user entity.

from alicebundle.

theofidry avatar theofidry commented on August 18, 2024

If you need a clear it's best to do it yourself. If it's systematic you can create a decorator service to handle this.

Otherwise you use the service to load objects and you expect those objects to be in a managed state. If not, you would need to reattach all of them.

from alicebundle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.