Permalink
Browse files

Added a working test RavenDb database and query, huzzah.

  • Loading branch information...
1 parent 2ec762b commit 121f66dee23641025c23c314c4374cbed0356332 @drlongnecker committed Mar 30, 2012
Showing with 131,403 additions and 51 deletions.
  1. +105 −10 FeckingSharpMvc.Core/FeckingSharpMvc.Core.fsproj
  2. +31 −2 FeckingSharpMvc.Core/HomeController.fs
  3. +22 −2 FeckingSharpMvc.Core/WebApplication.fs
  4. +8 −0 FeckingSharpMvc.Core/packages.config
  5. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Data
  6. +20 −0 FeckingSharpMvc.Web/App_Data/RavenDb/IndexDefinitions/Raven%2fDocumentsByEntityName.index
  7. +18 −0 FeckingSharpMvc.Web/App_Data/RavenDb/IndexDefinitions/Temp%2fPeople%2fByName.index
  8. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_0.cfs
  9. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_0_3.del
  10. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_1.cfs
  11. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_1_1.del
  12. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_2.cfs
  13. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_2_1.del
  14. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/_3.cfs
  15. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/segments.gen
  16. BIN FeckingSharpMvc.Web/App_Data/RavenDb/Indexes/Raven%2fDocumentsByEntityName/segments_8
  17. +8 −0 FeckingSharpMvc.Web/App_Data/RavenDb/desktop.ini
  18. +65,537 −0 FeckingSharpMvc.Web/App_Data/RavenDb/logs/RVNres00001.jrs
  19. +65,537 −0 FeckingSharpMvc.Web/App_Data/RavenDb/logs/RVNres00002.jrs
  20. BIN FeckingSharpMvc.Web/App_Data/RavenDb/raven-data.ico
  21. BIN FeckingSharpMvc.Web/App_Data/RavenDb/system/RVN.chk
  22. +76 −8 FeckingSharpMvc.Web/FeckingSharpMvc.Web.csproj
  23. BIN FeckingSharpMvc.Web/Raven.Studio.xap
  24. +1 −1 FeckingSharpMvc.Web/Views/Home/Index.cshtml
  25. +37 −28 FeckingSharpMvc.Web/Web.config
  26. +3 −0 FeckingSharpMvc.Web/packages.config
@@ -8,10 +8,11 @@
<OutputType>Library</OutputType>
<RootNamespace>FeckingSharpMvc.Core</RootNamespace>
<AssemblyName>FeckingSharpMvc.Core</AssemblyName>
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<Name>FeckingSharpMvc.Core</Name>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<RestorePackages>true</RestorePackages>
+ <TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -32,28 +33,122 @@
<WarningLevel>3</WarningLevel>
<DocumentationFile>bin\Release\FeckingSharpMvc.Core.XML</DocumentationFile>
</PropertyGroup>
+ <PropertyGroup>
+ <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
+ </PropertyGroup>
+ <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+ <ItemGroup>
+ <Compile Include="WebApplication.fs" />
+ <Compile Include="HomeController.fs" />
+ <None Include="packages.config" />
+ </ItemGroup>
<ItemGroup>
+ <Reference Include="AsyncCtpLibrary">
+ <HintPath>..\packages\RavenDB.1.0.701\lib\net40\AsyncCtpLibrary.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="BouncyCastle.Crypto">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\BouncyCastle.Crypto.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Esent.Interop">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Esent.Interop.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="ICSharpCode.NRefactory">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\ICSharpCode.NRefactory.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Lucene.Net">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Lucene.Net.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Lucene.Net.Contrib.Spatial">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Lucene.Net.Contrib.Spatial.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Lucene.Net.Contrib.SpellChecker">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Lucene.Net.Contrib.SpellChecker.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="mscorlib" />
<Reference Include="FSharp.Core, Version=4.3.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
+ <Reference Include="Newtonsoft.Json">
+ <HintPath>..\packages\Newtonsoft.Json.4.0.8\lib\net40\Newtonsoft.Json.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="NLog">
+ <HintPath>..\packages\NLog.2.0.0.2000\lib\net40\NLog.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Abstractions">
+ <HintPath>..\packages\RavenDB.1.0.701\lib\net40\Raven.Abstractions.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Client.Debug">
+ <HintPath>..\packages\RavenDB.1.0.701\lib\net40\Raven.Client.Debug.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Client.Embedded">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Raven.Client.Embedded.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Client.Lightweight">
+ <HintPath>..\packages\RavenDB.1.0.701\lib\net40\Raven.Client.Lightweight.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Client.MvcIntegration">
+ <HintPath>..\packages\RavenDB.1.0.701\lib\net40\Raven.Client.MvcIntegration.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Database">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Raven.Database.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Munin">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Raven.Munin.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Storage.Esent">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Raven.Storage.Esent.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Raven.Storage.Managed">
+ <HintPath>..\packages\RavenDB-Embedded.1.0.701\lib\net40\Raven.Storage.Managed.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
+ <Reference Include="Strangelights.FsRavenDbTools">
+ <HintPath>..\packages\FsRavenDbTools.0.5.4\lib\net40\Strangelights.FsRavenDbTools.dll</HintPath>
+ <Private>True</Private>
+ </Reference>
<Reference Include="System" />
+ <Reference Include="System.Activities" />
+ <Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Data.Linq" />
+ <Reference Include="System.Data.Services" />
+ <Reference Include="System.Data.Services.Client" />
+ <Reference Include="System.Device" />
+ <Reference Include="System.DirectoryServices.Protocols" />
+ <Reference Include="System.IdentityModel" />
+ <Reference Include="System.IO.Log" />
+ <Reference Include="System.Net" />
<Reference Include="System.Numerics" />
+ <Reference Include="System.Runtime.DurableInstancing" />
+ <Reference Include="System.ServiceModel" />
+ <Reference Include="System.ServiceModel.Activities" />
+ <Reference Include="System.ServiceModel.Discovery" />
+ <Reference Include="System.Transactions" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<Reference Include="System.Web.Routing" />
+ <Reference Include="WindowsBase" />
</ItemGroup>
- <ItemGroup>
- <Compile Include="WebApplication.fs" />
- <Compile Include="HomeController.fs" />
- </ItemGroup>
- <PropertyGroup>
- <MinimumVisualStudioVersion Condition="'$(MinimumVisualStudioVersion)' == ''">11</MinimumVisualStudioVersion>
- </PropertyGroup>
- <Import Project="$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets" Condition=" Exists('$(MSBuildExtensionsPath32)\..\Microsoft SDKs\F#\3.0\Framework\v4.0\Microsoft.FSharp.Targets')" />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
@@ -6,6 +6,16 @@ open System.Reflection
open Microsoft.FSharp.Quotations
open Microsoft.FSharp.Linq
open System.Collections.Generic
+open Raven.Client.Document
+open Strangelights.FsRavenDbTools.DocumentStoreExt
+open System.Data.Linq
+open System.Linq
+open Raven.Client.Embedded
+open Newtonsoft.Json
+open Raven.Client.Document
+open Strangelights.FsRavenDbTools
+open Raven.Storage.Esent
+open Raven.Storage.Managed
type Item = {
Id : int
@@ -17,6 +27,12 @@ type HomeIndexViewModel = {
AdditionalMessage : string
}
+type Person = {
+ Id : System.Guid
+ Name : string
+ CoolFactor : int
+}
+
[<HandleError>]
type HomeController() =
inherit Controller()
@@ -33,11 +49,24 @@ type HomeController() =
let expensiveItems =
items
|> Array.filter(fun i -> i.Price >= 1.00f)
-
+
+ let store = DocumentStore.OpenInitializedStore("~/App_Data/RavenDb")
+
+ let coolPerson =
+ { Id = System.Guid.NewGuid(); Name = "David"; CoolFactor = 11 }
+
+
+
+ let store = FeckingSharpMvc.Core.WebApplication.DocumentStore()
+ use session = store.OpenSession()
+ let coolPersonQuery = session.Query<Person>().Where(fun x -> x.Name = "David")
+ if not (coolPersonQuery.Any()) then session.Store(coolPerson)
+
x.ViewData.["Message"] <- msg
x.ViewData.["Items"] <- items
x.ViewData.["ExpensiveItems"] <- expensiveItems
-
+ x.ViewData.["CoolPerson"] <- coolPersonQuery.First()
+
let model = { AdditionalMessage = "Huzzah!" }
x.View(model)
@@ -4,6 +4,10 @@ open System
open System.Web
open System.Web.Mvc
open System.Web.Routing
+open Raven.Client.Embedded
+open Newtonsoft.Json
+open Raven.Client.Document
+open Strangelights.FsRavenDbTools
type Route = {
controller : string
@@ -13,10 +17,26 @@ type Route = {
type WebApplication() =
inherit System.Web.HttpApplication()
+ static let mutable documentStore : Raven.Client.Embedded.EmbeddableDocumentStore = null
+
+ static member DocumentStore() =
+ documentStore
+
static member RegisterRoutes(routes:RouteCollection) =
routes.Ignore("{resource}.axd/{*pathInfo}")
- routes.MapRoute("default", "{controller}/{action}/{id}", { controller = "Home"; action = "Index"; id = UrlParameter.Optional })
+ routes.MapRoute("default", "{controller}/{action}/{id}", { controller = "Home"; action = "Index"; id = UrlParameter.Optional })
member x.Start() =
AreaRegistration.RegisterAllAreas()
- WebApplication.RegisterRoutes(RouteTable.Routes)
+ WebApplication.RegisterRoutes(RouteTable.Routes) |> ignore
+
+ documentStore <- new Raven.Client.Embedded.EmbeddableDocumentStore()
+ documentStore.DataDirectory <- "~/App_Data/RavenDb"
+ #if DEBUG
+ documentStore.UseEmbeddedHttpServer <- true
+ #endif
+ let addConverters (converters: JsonConverterCollection) =
+ converters.Add(new OptionTypeConverter())
+ converters.Add(new UnionTypeConverter())
+ documentStore.Conventions.CustomizeJsonSerializer <- new Action<JsonSerializer>(fun x -> addConverters x.Converters)
+ documentStore.Initialize() |> ignore
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="FsRavenDbTools" version="0.5.4" />
+ <package id="Newtonsoft.Json" version="4.0.8" />
+ <package id="NLog" version="2.0.0.2000" />
+ <package id="RavenDB" version="1.0.701" />
+ <package id="RavenDB-Embedded" version="1.0.701" />
+</packages>
Binary file not shown.
@@ -0,0 +1,20 @@
+{
+ "Name": "Raven/DocumentsByEntityName",
+ "Map": "from doc in docs \r\nlet Tag = doc[\"@metadata\"][\"Raven-Entity-Name\"]\r\nselect new { Tag, LastModified = (DateTime)doc[\"@metadata\"][\"Last-Modified\"] };",
+ "Maps": [
+ "from doc in docs \r\nlet Tag = doc[\"@metadata\"][\"Raven-Entity-Name\"]\r\nselect new { Tag, LastModified = (DateTime)doc[\"@metadata\"][\"Last-Modified\"] };"
+ ],
+ "Reduce": null,
+ "TransformResults": null,
+ "IsMapReduce": false,
+ "IsCompiled": false,
+ "IsTemp": false,
+ "Stores": {},
+ "Indexes": {
+ "Tag": "NotAnalyzed"
+ },
+ "SortOptions": {},
+ "Analyzers": {},
+ "Fields": [],
+ "Type": "Map"
+}
@@ -0,0 +1,18 @@
+{
+ "Name": "Temp/People/ByName",
+ "Map": "from doc in docs.People\r\nselect new { Name = doc.Name }",
+ "Maps": [
+ "from doc in docs.People\r\nselect new { Name = doc.Name }"
+ ],
+ "Reduce": null,
+ "TransformResults": null,
+ "IsMapReduce": false,
+ "IsCompiled": false,
+ "IsTemp": true,
+ "Stores": {},
+ "Indexes": {},
+ "SortOptions": {},
+ "Analyzers": {},
+ "Fields": [],
+ "Type": "Temp"
+}
@@ -0,0 +1,8 @@
+
+[.ShellClassInfo]
+IconResource=J:\projects\FeckingSharpMvc\FeckingSharpMvc.Web\App_Data\RavenDb\raven-data.ico,0
+InfoTip=RavenDB's data folder. It is recommended that you will back up this folder on a regular basis.
+[ViewState]
+Mode=
+Vid=
+FolderType=Generic
Oops, something went wrong.

0 comments on commit 121f66d

Please sign in to comment.