Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed syntax problems in Application.vb.

  • Loading branch information...
commit 6bd9a60911285435161fcdd9f548f69386715f80 1 parent 9a103dd
unknown authored
View
5 .gitignore
@@ -28,3 +28,8 @@
/_UpgradeReport_Files/*
/redist/*.zip
+
+/examples/Simple/obj/Debug/Simple.csproj.FileListAbsolute.txt
+/examples/Simple/obj/Debug/Simple.exe
+/examples/SimpleVB/obj/Debug/SimpleVB.exe
+/examples/SimpleVB/obj/Debug/SimpleVB.vbproj.FileListAbsolute.txt
View
2  MongoDB.Driver.Benchmark/MongoDB.Driver.Benchmark.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
2  MongoDB.GridFS.Tests/MongoDB.GridFS.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
2  MongoDB.GridFS/MongoDB.GridFS.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
2  MongoDB.Linq.Tests/MongoDB.Linq.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
2  MongoDB.Linq/MongoDB.Linq.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
2  MongoDB.Net-Tests/MongoDB.Driver.Tests.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
13 MongoDBDriver.sln
@@ -1,6 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
+# SharpDevelop 3.1.0.4890
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.Driver", "MongoDBDriver\MongoDB.Driver.csproj", "{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}"
EndProject
Project("{9344bdbb-3e7f-41fc-a0dd-8665d75ee146}") = "Packages", "Packages.mdproj", "{502F3381-58AA-461B-B9D8-12578A588C61}"
@@ -18,6 +19,8 @@ EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MongoDB.GridFS.Tests", "MongoDB.GridFS.Tests\MongoDB.GridFS.Tests.csproj", "{0C293FE9-F670-4FEF-A60F-20F8C978B1CD}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{4345382B-FAA2-46E2-99CF-C90ACA2DD574}"
+ ProjectSection(SolutionItems) = postProject
+ EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Simple", "examples\Simple\Simple.csproj", "{131BDB5F-5C6F-4AC7-B03E-394B1B75E120}"
EndProject
@@ -67,10 +70,8 @@ Global
{C8BC95AB-25C6-4133-BC9F-8B6BB782CA02}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8BC95AB-25C6-4133-BC9F-8B6BB782CA02}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C8BC95AB-25C6-4133-BC9F-8B6BB782CA02}.Release|Any CPU.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(NestedProjects) = preSolution
- {131BDB5F-5C6F-4AC7-B03E-394B1B75E120} = {4345382B-FAA2-46E2-99CF-C90ACA2DD574}
- {1BAAE3D8-7720-4AA5-9335-E59824E7B667} = {4345382B-FAA2-46E2-99CF-C90ACA2DD574}
+ {502F3381-58AA-461B-B9D8-12578A588C61}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {502F3381-58AA-461B-B9D8-12578A588C61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = MongoDBDriver\MongoDB.Driver.csproj
@@ -104,4 +105,8 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
+ GlobalSection(NestedProjects) = preSolution
+ {1BAAE3D8-7720-4AA5-9335-E59824E7B667} = {4345382B-FAA2-46E2-99CF-C90ACA2DD574}
+ {131BDB5F-5C6F-4AC7-B03E-394B1B75E120} = {4345382B-FAA2-46E2-99CF-C90ACA2DD574}
+ EndGlobalSection
EndGlobal
View
2  MongoDBDriver/MongoDB.Driver.csproj
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
View
100 examples/Simple/Simple.csproj
@@ -1,51 +1,51 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
- <PropertyGroup>
- <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
- <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
- <ProductVersion>9.0.21022</ProductVersion>
- <SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{131BDB5F-5C6F-4AC7-B03E-394B1B75E120}</ProjectGuid>
- <OutputType>Exe</OutputType>
- <RootNamespace>Simple</RootNamespace>
- <AssemblyName>Simple</AssemblyName>
- <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
- <DebugSymbols>true</DebugSymbols>
- <DebugType>full</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Debug</OutputPath>
- <DefineConstants>DEBUG</DefineConstants>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
- <DebugType>none</DebugType>
- <Optimize>false</Optimize>
- <OutputPath>bin\Release</OutputPath>
- <ErrorReport>prompt</ErrorReport>
- <WarningLevel>4</WarningLevel>
- </PropertyGroup>
- <ItemGroup>
- <Reference Include="System" />
- <Reference Include="System.Core" />
- <Reference Include="System.Configuration" />
- </ItemGroup>
- <ItemGroup>
- <Compile Include="Main.cs" />
- <Compile Include="AssemblyInfo.cs" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\..\MongoDBDriver\MongoDB.Driver.csproj">
- <Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
- <Name>MongoDB.Driver</Name>
- </ProjectReference>
- </ItemGroup>
- <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
- <ItemGroup>
- <None Include="Simple.exe.config">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- </ItemGroup>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{131BDB5F-5C6F-4AC7-B03E-394B1B75E120}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>Simple</RootNamespace>
+ <AssemblyName>Simple</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug</OutputPath>
+ <DefineConstants>DEBUG</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>none</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Configuration" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Main.cs" />
+ <Compile Include="AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\MongoDBDriver\MongoDB.Driver.csproj">
+ <Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
+ <Name>MongoDB.Driver</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <ItemGroup>
+ <None Include="Simple.exe.config">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
</Project>
View
182 examples/SimpleVB/Application.vb
@@ -1,89 +1,93 @@
-imports System
-imports System.Configuration
-
-imports MongoDB.Driver
-
-Namespace Simple
-
- '''<summary>
- '''Illustrates some simple operations on the database.
- '''Creating a database connection.
- '''Remove some documents.
- '''Insert some documents
- '''Find one document
- '''Find several documents and iterate through them.
- '''</summary>
-
- Public Class Application
- Private mongo as Mongo
- Private simple as Database
- Private categories as IMongoCollection
-
- Public Shared Sub Main()
- Dim app As New Application()
- app.Setup()
- //main.Run()
- End Sub
-
- ''' <summary>
- ''' Setup the collection and insert some data into it.
- ''' </summary>
- Public Sub Setup()
- dim connstr as string = ConfigurationManager.AppSettings("simple")
- if String.IsNullOrEmpty(connstr) then throw new ArgumentNullException("Connection string not found.")
- mongo = new Mongo(connstr)
- mongo.Connect()
- simple = mongo("simple")
- categories = simple("categories")
- //Clean()
-
- Dim names() As String = {"Bluez", "Jazz", "Classical", "Rock", "Oldies", "Heavy Metal"}
-
- For Each name As string In names
- categories.Insert(new Document().Append("name", name))
- Next
- End Sub
-
- Public Sub Clean()
- categories.Delete(new Document().Append("name", "Jazz")) 'remove documents with the name Jazz.
- categories.Delete(new Document()) 'remove everything from the categories collection.
- End Sub
- Public Sub Run()
- Dim category As Document = categories.FindOne(new Document.Append("name", "Bluez"))
-
- Console.WriteLine ("The id findOne" + category("_id"))
-
- Dim selector As Document = New Document().Append("_id", category("_id"))
-
- category("name") = "Bluess"
- 'The following will do the same thing.
- categories.Update(category)
-
- Console.WriteLine("Category after one update " + categories.FindOne(selector).ToString())
-
- category("name") = "Blues"
- categories.Update(category, selector)
-
- Console.WriteLine("Category after two updates " + categories.FindOne(selector).ToString())
-
- 'Find it by _id that has been converted to a string now.
- Dim id As String = CType(category("_id"),Oid).ToString()
-
- Console.WriteLine("Found by string id converted back to Oid")
- Console.WriteLine(categories.FindOne(new Document().Append("_id", new Oid(id.Replace("""", "")))).ToString())
-
- 'Find(new Document()) is equivalent to FindAll()
- 'Specifying the cursor in a using block will close it on the server if we decide not
- 'to iterate through the whole thing.
-REM using(ICursor all = categories.Find(new Document())){
-REM foreach(Document doc in all.Documents){
-REM Console.WriteLine(doc.ToString());
-REM }
-REM }
-
- mongo.Disconnect()
- End Sub
-
- End Class
-
-End Namespace
+imports System
+imports System.Configuration
+
+imports MongoDB.Driver
+
+Namespace Simple
+
+ '''<summary>
+ '''Illustrates some simple operations on the database.
+ '''Creating a database connection.
+ '''Remove some documents.
+ '''Insert some documents
+ '''Find one document
+ '''Find several documents and iterate through them.
+ '''</summary>
+ Public Class Application
+ Private mongo as Mongo
+ Private simple as Database
+ Private categories as IMongoCollection
+
+ Public Shared Sub Main()
+ Dim app As New Application()
+ app.Setup()
+ app.Run()
+ Console.WriteLine("Press any key to continue...")
+ Console.ReadKey()
+ End Sub
+
+ ''' <summary>
+ ''' Setup the collection and insert some data into it.
+ ''' </summary>
+ Public Sub Setup()
+ dim connstr as string = ConfigurationManager.AppSettings("simple")
+ if String.IsNullOrEmpty(connstr) then throw new ArgumentNullException("Connection string not found.")
+ mongo = new Mongo(connstr)
+ mongo.Connect()
+ simple = mongo("simple")
+ categories = simple("categories")
+ Clean()
+
+ Dim names() As String = {"Bluez", "Jazz", "Classical", "Rock", "Oldies", "Heavy Metal"}
+
+ For Each name As string In names
+ categories.Insert(new Document().Append("name", name))
+ Next
+ End Sub
+
+ Public Sub Clean()
+ categories.Delete(new Document().Append("name", "Jazz")) 'remove documents with the name Jazz.
+ categories.Delete(new Document()) 'remove everything from the categories collection.
+ End Sub
+ Public Sub Run()
+ Dim category As Document = categories.FindOne(new Document().Append("name", "Bluez"))
+
+ Console.WriteLine ("The id findOne" & category("_id").ToString())
+
+ Dim selector As Document = New Document().Append("_id", category("_id"))
+
+ category("name") = "Bluess"
+ 'The following will do the same thing.
+ categories.Update(category)
+
+ Console.WriteLine("Category after one update " + categories.FindOne(selector).ToString())
+
+ category("name") = "Blues"
+ categories.Update(category, selector)
+
+ Console.WriteLine("Category after two updates " + categories.FindOne(selector).ToString())
+
+ 'Find it by _id that has been converted to a string now.
+ Dim id As String = CType(category("_id"),Oid).ToString()
+
+ Console.WriteLine("Found by string id converted back to Oid")
+ Console.WriteLine(categories.FindOne(new Document().Append("_id", new Oid(id.Replace("""", "")))).ToString())
+
+ 'Find(new Document()) is equivalent to FindAll()
+ 'Specifying the cursor in a using block will close it on the server if we decide not
+ 'to iterate through the whole thing.
+ Dim all As ICursor = categories.Find(New Document())
+ Try
+ For Each doc As Document In all.Documents
+ Console.WriteLine(doc.ToString())
+ Next
+ Finally
+ all.Dispose()
+ End Try
+
+ mongo.Disconnect()
+ End Sub
+
+ End Class
+
+End Namespace
View
6 examples/SimpleVB/SimpleVB.exe.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="simple" value="Server=localhost:27017"/>
+ </appSettings>
+</configuration>
View
51 examples/SimpleVB/SimpleVB.vbproj
@@ -1 +1,50 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.21022</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{1BAAE3D8-7720-4AA5-9335-E59824E7B667}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <RootNamespace>SimpleVB</RootNamespace>
+ <OptionStrict>On</OptionStrict>
+ <OptionInfer>On</OptionInfer>
+ <AssemblyName>SimpleVB</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <OutputPath>bin\Debug</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <DefineTrace>false</DefineTrace>
+ <AdditionalParameters />
+ <DefineDebug>false</DefineDebug>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <OutputPath>bin\Release</OutputPath>
+ <ErrorReport>prompt</ErrorReport>
+ <DefineTrace>false</DefineTrace>
+ <AdditionalParameters />
+ <DefineDebug>false</DefineDebug>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Configuration" />
+ <Reference Include="System.Core" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Application.vb" />
+ <Compile Include="AssemblyInfo.vb" />
+ <None Include="SimpleVB.exe.config">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </None>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\MongoDBDriver\MongoDB.Driver.csproj">
+ <Project>{B125BBA6-BFFD-44FA-9254-9B1754CD8AF3}</Project>
+ <Name>MongoDB.Driver</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.VisualBasic.targets" />
+</Project>
Please sign in to comment.
Something went wrong with that request. Please try again.