Click here to Skip to main content
15,919,879 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Move project resources to separate file Pin
satc13-Jun-15 13:27
satc13-Jun-15 13:27 
GeneralRe: Move project resources to separate file Pin
Eddy Vluggen13-Jun-15 13:36
professionalEddy Vluggen13-Jun-15 13:36 
GeneralRe: Move project resources to separate file Pin
satc13-Jun-15 13:49
satc13-Jun-15 13:49 
GeneralRe: Move project resources to separate file Pin
Eddy Vluggen14-Jun-15 1:49
professionalEddy Vluggen14-Jun-15 1:49 
QuestionMimic the Recycle Bin on a vb.net+SQl server database Pin
satc12-Jun-15 15:45
satc12-Jun-15 15:45 
AnswerRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Sascha Lefèvre12-Jun-15 16:48
professionalSascha Lefèvre12-Jun-15 16:48 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
satc12-Jun-15 17:41
satc12-Jun-15 17:41 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Sascha Lefèvre12-Jun-15 23:56
professionalSascha Lefèvre12-Jun-15 23:56 
There's no way to delete all entities (with "Deleted=true") regardless of their type with a single "command" (unless you create a stored procedure for that in which case the "trouble" would just be moved there).

Options:

1) Via the context (pseudo code):
VB
entities1 = context.Entity1.Where(e => e.Deleted).ToList()
foreach(entity in entities1)
   context.DeleteObject(entity)

' repeat for other entities

context.SaveChanges()

Not beautiful because of code repetition.

2) Via the context with reflection:
find all entity types in the context
foreach found entity type
   dynamically build a query like above (1) and run the query
       foreach found entity
           context.DeleteObject(entity)

context.SaveChanges()

No code repetition but considerably more effort.

3) Via direct SQL:
You would have to have a list of all table names in the database (could be obtained via the information schema).
VB
foreach(tableName in tableNames)
   context.DataBase.ExecuteSqlCommand("DELETE FROM " + tableName + " WHERE Deleted = True")

If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson

GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Eddy Vluggen13-Jun-15 11:55
professionalEddy Vluggen13-Jun-15 11:55 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
satc15-Jun-15 23:22
satc15-Jun-15 23:22 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Eddy Vluggen16-Jun-15 0:29
professionalEddy Vluggen16-Jun-15 0:29 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
satc16-Jun-15 0:50
satc16-Jun-15 0:50 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Eddy Vluggen16-Jun-15 1:02
professionalEddy Vluggen16-Jun-15 1:02 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
satc16-Jun-15 9:17
satc16-Jun-15 9:17 
GeneralRe: Mimic the Recycle Bin on a vb.net+SQl server database Pin
Eddy Vluggen16-Jun-15 11:08
professionalEddy Vluggen16-Jun-15 11:08 
QuestionConsole Application: read xml from unc-path with passed credentials Pin
Member 1170954712-Jun-15 9:44
Member 1170954712-Jun-15 9:44 
AnswerRe: Console Application: read xml from unc-path with passed credentials Pin
Eddy Vluggen13-Jun-15 11:42
professionalEddy Vluggen13-Jun-15 11:42 
QuestionGreat Confusing Problem with VB.NET Pin
Robot Sun10-Jun-15 23:22
Robot Sun10-Jun-15 23:22 
AnswerRe: Great Confusing Problem with VB.NET Pin
Richard MacCutchan11-Jun-15 1:06
mveRichard MacCutchan11-Jun-15 1:06 
AnswerMessage Closed Pin
15-Jun-15 12:32
professionalSimewu15-Jun-15 12:32 
GeneralRe: Great Confusing Problem with VB.NET Pin
Robot Sun17-Jul-15 23:26
Robot Sun17-Jul-15 23:26 
QuestionIf internet connection is present , get the real date and time Pin
satc10-Jun-15 17:38
satc10-Jun-15 17:38 
AnswerRe: If internet connection is present , get the real date and time Pin
Richard MacCutchan10-Jun-15 21:36
mveRichard MacCutchan10-Jun-15 21:36 
Questionvb.net 2010 default value for shared variable Pin
classy_dog10-Jun-15 8:47
classy_dog10-Jun-15 8:47 
AnswerRe: vb.net 2010 default value for shared variable Pin
Eddy Vluggen10-Jun-15 9:34
professionalEddy Vluggen10-Jun-15 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.