Comments (1)
Hi @LeMoussel,
The recommended way is to use the same key used to store the item, since it will use a database index (best performance).
So, if you have a key that was used to store the inserted row, you can pass it as the first parameter:
// save an item with a key associated
db.Set ("my_key_for_this_item", new MyExampleClass ());
// remove it
db.FindAndRemove ("my_key_for_this_item", null);
Usually I recommend to store the key with the object, to make things easier!
Example:
var row = new MyExampleRow ();
row.Id = "my_key_for_this_item";
// save an item with a key associated
db.Set (row.Id, row);
// remove it
db.FindAndRemove (row.Id, null);
There are other uses, but uses the LIKE
sql expression to remove rows. This is slow, since is not using an index, and may have undesirable consequences, so only use it if you know what is happening behind the scenes!
Example:
var user = new MyExampleUser ();
row.Id = "my_key_for_this_item";
row.Name = "my name";
row.Password = "*******";
// save an item with a key associated
db.Set (row.Id, row);
// remove it by name
db.FindAndRemove (null, new { Name = "my name" });
// OR remove it by key and name
db.FindAndRemove ("my_key_for_this_item", new { Name = "my name" });
from simplehelpers.net.
Related Issues (11)
- What is the most optimized method to Remove and Return the first element? HOT 1
- Incorrect handling of sub-collections HOT 3
- Feature request: Support circular references HOT 3
- NamedLock looks unsafe for concurrent use HOT 1
- Plans to support .NET Core? HOT 1
- CheckForByteOrderMark fails to recognize Unicode Little-Endian HOT 1
- List comparison returning object instead of array. HOT 1
- Possible issue with CheckForTextualData HOT 1
- ObjectDiffPatch fails, if target value of array property is null.
- Object2String Generator HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from simplehelpers.net.