Breeze - removing element from cache












2















I am keeping local entities in breeze cache, how can i delete them from the cache with out going to the server?
in the documentation it states




Deleting an entity
You delete an entity by changing its EntityState to “Deleted” like this:




1
someEntity.entityAspect.setDeleted(); // mark for deletion
setDeleted does not destroy the object locally nor does it remove the entity from the database. The entity simply remains in cache in its new “Deleted” state … as changed and added entities do. A successful save does delete the entity from the database and remove it from cache.










share|improve this question



























    2















    I am keeping local entities in breeze cache, how can i delete them from the cache with out going to the server?
    in the documentation it states




    Deleting an entity
    You delete an entity by changing its EntityState to “Deleted” like this:




    1
    someEntity.entityAspect.setDeleted(); // mark for deletion
    setDeleted does not destroy the object locally nor does it remove the entity from the database. The entity simply remains in cache in its new “Deleted” state … as changed and added entities do. A successful save does delete the entity from the database and remove it from cache.










    share|improve this question

























      2












      2








      2








      I am keeping local entities in breeze cache, how can i delete them from the cache with out going to the server?
      in the documentation it states




      Deleting an entity
      You delete an entity by changing its EntityState to “Deleted” like this:




      1
      someEntity.entityAspect.setDeleted(); // mark for deletion
      setDeleted does not destroy the object locally nor does it remove the entity from the database. The entity simply remains in cache in its new “Deleted” state … as changed and added entities do. A successful save does delete the entity from the database and remove it from cache.










      share|improve this question














      I am keeping local entities in breeze cache, how can i delete them from the cache with out going to the server?
      in the documentation it states




      Deleting an entity
      You delete an entity by changing its EntityState to “Deleted” like this:




      1
      someEntity.entityAspect.setDeleted(); // mark for deletion
      setDeleted does not destroy the object locally nor does it remove the entity from the database. The entity simply remains in cache in its new “Deleted” state … as changed and added entities do. A successful save does delete the entity from the database and remove it from cache.







      breeze






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 5 '14 at 19:27









      li-razli-raz

      83121942




      83121942
























          2 Answers
          2






          active

          oldest

          votes


















          3














          You can do this by detaching the entity from entity manager by calling manager's detachEntity method :



          manager.detachEntity(entity);


          The detached entity will eventually be garbage collected.



          Refer to Breeze-Inside Entity






          share|improve this answer


























          • Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

            – mmcrae
            Nov 21 '18 at 16:30



















          0














          You can do
          entity.setDeleted();
          and then call
          saveChanges method.
          if you want to save it in DB.
          if not want to go to server
          manager.detachEntity(nameofYourEntity);






          share|improve this answer

























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21586657%2fbreeze-removing-element-from-cache%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            3














            You can do this by detaching the entity from entity manager by calling manager's detachEntity method :



            manager.detachEntity(entity);


            The detached entity will eventually be garbage collected.



            Refer to Breeze-Inside Entity






            share|improve this answer


























            • Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

              – mmcrae
              Nov 21 '18 at 16:30
















            3














            You can do this by detaching the entity from entity manager by calling manager's detachEntity method :



            manager.detachEntity(entity);


            The detached entity will eventually be garbage collected.



            Refer to Breeze-Inside Entity






            share|improve this answer


























            • Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

              – mmcrae
              Nov 21 '18 at 16:30














            3












            3








            3







            You can do this by detaching the entity from entity manager by calling manager's detachEntity method :



            manager.detachEntity(entity);


            The detached entity will eventually be garbage collected.



            Refer to Breeze-Inside Entity






            share|improve this answer















            You can do this by detaching the entity from entity manager by calling manager's detachEntity method :



            manager.detachEntity(entity);


            The detached entity will eventually be garbage collected.



            Refer to Breeze-Inside Entity







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Feb 10 '14 at 6:46

























            answered Feb 7 '14 at 7:47









            SarcasticSarcastic

            619514




            619514













            • Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

              – mmcrae
              Nov 21 '18 at 16:30



















            • Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

              – mmcrae
              Nov 21 '18 at 16:30

















            Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

            – mmcrae
            Nov 21 '18 at 16:30





            Are there any guidelines for undoing changes for each component/screen? Facing an issue where one Angular component does .createEntity(), but then the user goes to a differen component (without a page refresh, so the createEntity() is still being tracked). Is it advised to just put rejectChanges() at the start-up and destroy of each component, to avoid pending changes from a previous long-gone component?

            – mmcrae
            Nov 21 '18 at 16:30













            0














            You can do
            entity.setDeleted();
            and then call
            saveChanges method.
            if you want to save it in DB.
            if not want to go to server
            manager.detachEntity(nameofYourEntity);






            share|improve this answer






























              0














              You can do
              entity.setDeleted();
              and then call
              saveChanges method.
              if you want to save it in DB.
              if not want to go to server
              manager.detachEntity(nameofYourEntity);






              share|improve this answer




























                0












                0








                0







                You can do
                entity.setDeleted();
                and then call
                saveChanges method.
                if you want to save it in DB.
                if not want to go to server
                manager.detachEntity(nameofYourEntity);






                share|improve this answer















                You can do
                entity.setDeleted();
                and then call
                saveChanges method.
                if you want to save it in DB.
                if not want to go to server
                manager.detachEntity(nameofYourEntity);







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 15 '18 at 7:40

























                answered Nov 15 '18 at 7:19









                Adeel ShekhaniAdeel Shekhani

                92119




                92119






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f21586657%2fbreeze-removing-element-from-cache%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Xamarin.iOS Cant Deploy on Iphone

                    Glorious Revolution

                    Dulmage-Mendelsohn matrix decomposition in Python