SubSonic IsDeleted Flag
Database August 23rd, 2008When using SubSonic you have support for deleting a record instead of destroying it. Deleting would be having a flag Deleted or IsDeleted set to true. Destroying removes the record from the Table.
SubSonic adds logic to the classes if a Table contiains a Deleted or IsDeleted column (a non null bit column). Setting this Flag to true is very easy (SubSonic 2.1):
1 | Dal.Channels.Delete(channelId); |
If the table doesn’t have a Deleted or IsDeleted flag, the record will be removed.
Getting all the channels in SubSonic would normally be done like this:
1 2 | ChannelsCollection channelColl = new ChannelsCollection ().Where(Channels.Column.IsDeleted, false).Load(); |
With SubSonic 2.1 howver the same result is gotten using just:
1 | ChannelsCollection userColl = new ChannelsCollection ().Load(); |
No TweetBacks yet. (Be the first to Tweet this post)
Follow Me!