Delete example

Nov 21, 2010 at 1:26 PM
Hi Would you please be able to provide an example of deleting a record from a table. I can't work out how you go from an object you have (ie contact) to a guid to remove the record. Also, any news on the next release?? Cheers Sam
Coordinator
Nov 21, 2010 at 1:36 PM
Hi Sam,

Sorry if it wasn't clear how to do this, the following code is
something I've just worked out, so I can't guarantee it being 100%
working, but I'm sure it's fine (it's how I recall doing it when
writing the code anyway)

contacts.RemoveRecord(
contacts.Records.DefaultIfEmpty(null).FirstOrDefault(record
=> record.Value == [object here]).Identifier);

If you need some context, this is supposed to fit into the Test
console project in the solution.

You could perhaps write an extension method so finding an identifier
by object in a table could be much easier.

But as far as I'm aware this code is the way to do it.

As for the next release, I'm tied up with a new job, but I will
endeavour to work on it in my free time, FlatDB is actually part of a
much bigger project I'm working on, so it will be inevitably upgraded
in one form or another.

Clint

On Sun, Nov 21, 2010 at 1:26 PM, [email removed] wrote:
> From: samward
>
> Hi Would you please be able to provide an example of deleting a record from
> a table. I can't work out how you go from an object you have (ie contact) to
> a guid to remove the record. Also, any news on the next release?? Cheers Sam
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed]@discussions.codeplex.com)
>
> To start a new discussion for this project, email
> [email removed]@discussions.codeplex.com
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Nov 22, 2010 at 1:02 AM

> contacts.RemoveRecord(
> contacts.Records.DefaultIfEmpty(null).FirstOrDefault(record
> => record.Value == [object here]).Identifier);

Yes,  thats done the trick.  Cheers. 

(When I get a chance I think I will wrap that up in an extension method :-) )

 

Coordinator
Nov 22, 2010 at 6:54 AM
Glad that worked, I typed it out in a couple of minutes to get back to
you quickly haha.

Yeh, an extension method sounds like a good idea, I'm sure I'll come
up with a more streamlined means of deleting records in the next
version.

Glad you're enjoying the project.

Clint Pearson
>