Breeze - removing element from cache
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
add a comment |
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
add a comment |
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
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
breeze
asked Feb 5 '14 at 19:27
li-razli-raz
83121942
83121942
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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
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 thecreateEntity()
is still being tracked). Is it advised to just putrejectChanges()
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
add a comment |
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);
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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
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 thecreateEntity()
is still being tracked). Is it advised to just putrejectChanges()
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
add a comment |
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
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 thecreateEntity()
is still being tracked). Is it advised to just putrejectChanges()
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
add a comment |
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
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
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 thecreateEntity()
is still being tracked). Is it advised to just putrejectChanges()
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
add a comment |
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 thecreateEntity()
is still being tracked). Is it advised to just putrejectChanges()
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
add a comment |
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);
add a comment |
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);
add a comment |
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);
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);
edited Nov 15 '18 at 7:40
answered Nov 15 '18 at 7:19
Adeel ShekhaniAdeel Shekhani
92119
92119
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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