Created
October 10, 2011 08:13
-
-
Save codereflection/1274851 to your computer and use it in GitHub Desktop.
Simple.Data - yeah, it works in VB too, who knew? :P
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Imports System.Dynamic | |
Module SimpleVBDataCatz | |
Sub Main() | |
Console.WriteLine("Let's see some of this Simple.Data magick in VB") | |
Dim db = Database.Opener.OpenFile("Data\ICanHazData.sdf") | |
InsertTimmyCatAsAnonymousObject(db) | |
InsertCookieCatAsNamedParameter(db) | |
Console.WriteLine("{0} Cats in the database", db.Cats.All().ToList().Count()) | |
For Each cat In db.Cats.All() | |
Console.WriteLine("Name: {0}, Age: {1}", cat.Name, cat.Age) | |
Next | |
Console.ReadKey() | |
End Sub | |
Private Sub InsertTimmyCatAsAnonymousObject(ByVal db As Object) | |
Dim Timmy = New With {.Name = "Timmy", .Age = 15} | |
Timmy.Name = "Timmy" | |
Timmy.Age = 15 | |
db.Cats.Insert(Timmy) | |
End Sub | |
Private Sub InsertCookieCatAsNamedParameter(db As Object) | |
db.Cats.Insert(Name:="Cookie", Age:=16) | |
End Sub | |
End Module |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment