Permalink
Browse files

fix mono build errors

  • Loading branch information...
1 parent 96dbc60 commit 0c9eab775fb2772928c8b4383cf7e4ff333fe761 @mythz mythz committed Aug 13, 2012
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+ <configSections>
+ <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
+ <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
+ </sectionGroup>
+ </configSections>
+ <system.web.webPages.razor>
+ <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
+ <pages pageBaseType="ServiceStack.Razor.ViewPage">
+ <namespaces>
+ <add namespace="ServiceStack.Html" />
+ <add namespace="ServiceStack.Razor" />
+ <add namespace="ServiceStack.Text" />
+ <add namespace="ServiceStack.OrmLite" />
+ <add namespace="RazorRockstars.Console" />
+ </namespaces>
+ </pages>
+ </system.web.webPages.razor>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
+ </startup>
+ <runtime>
+ <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+ <dependentAssembly>
+ <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
+ <bindingRedirect oldVersion="0.0.0.0-1.0.81.0" newVersion="1.0.81.0" />
+ </dependentAssembly>
+ </assemblyBinding>
+ </runtime>
+</configuration>
@@ -0,0 +1,131 @@
+using System.Collections.Generic;
+using System.Runtime.Serialization;
+using Funq;
+using ServiceStack.Common;
+using ServiceStack.DataAnnotations;
+using ServiceStack.OrmLite;
+using ServiceStack.OrmLite.Sqlite;
+using ServiceStack.Razor;
+using ServiceStack.ServiceHost;
+using ServiceStack.ServiceInterface;
+using ServiceStack.WebHost.Endpoints;
+
+//The entire C# code for the stand-alone RazorRockstars demo.
+namespace RazorRockstars.Console
+{
+ public class AppHost : AppHostHttpListenerBase
+ {
+ public AppHost() : base("Test Razor", typeof(AppHost).Assembly) { }
+
+ public override void Configure(Container container)
+ {
+ Plugins.Add(new RazorFormat());
+
+ container.Register<IDbConnectionFactory>(
+ new OrmLiteConnectionFactory(":memory:", false, SqliteOrmLiteDialectProvider.Instance));
+
+ using (var db = container.Resolve<IDbConnectionFactory>().OpenDbConnection())
+ {
+ db.CreateTable<Rockstar>(overwrite: false); //Create table if not exists
+ db.Insert(Rockstar.SeedData); //Populate with seed data
+ }
+ }
+
+ private static void Main(string[] args)
+ {
+ var appHost = new AppHost();
+ appHost.Init();
+ appHost.Start("http://*:1337/");
+ System.Console.WriteLine("Listening on http://localhost:1337/ ...");
+ System.Console.ReadLine();
+ }
+ }
+
+ public class Rockstar
+ {
+ public static Rockstar[] SeedData = new[] {
+ new Rockstar(1, "Jimi", "Hendrix", 27),
+ new Rockstar(2, "Janis", "Joplin", 27),
+ new Rockstar(3, "Jim", "Morrisson", 27),
+ new Rockstar(4, "Kurt", "Cobain", 27),
+ new Rockstar(5, "Elvis", "Presley", 42),
+ new Rockstar(6, "Michael", "Jackson", 50),
+ };
+
+ [AutoIncrement]
+ public int Id { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public int? Age { get; set; }
+
+ public Rockstar() { }
+ public Rockstar(int id, string firstName, string lastName, int age)
+ {
+ Id = id;
+ FirstName = firstName;
+ LastName = lastName;
+ Age = age;
+ }
+ }
+
+ [RestService("/rockstars")]
+ [RestService("/rockstars/aged/{Age}")]
+ [RestService("/rockstars/delete/{Delete}")]
+ [RestService("/rockstars/{Id}")]
+ public class Rockstars
+ {
+ public int Id { get; set; }
+ public string FirstName { get; set; }
+ public string LastName { get; set; }
+ public int? Age { get; set; }
+ public string Delete { get; set; }
+ }
+
+ [DataContract] //Attrs for CSV Format to recognize it's a DTO and serialize the Enumerable property
+ public class RockstarsResponse
+ {
+ [DataMember] public int Total { get; set; }
+ [DataMember] public int? Aged { get; set; }
+ [DataMember] public List<Rockstar> Results { get; set; }
+ }
+
+ public class RockstarsService : RestServiceBase<Rockstars>
+ {
+ public IDbConnectionFactory DbFactory { get; set; }
+
+ public override object OnGet(Rockstars request)
+ {
+ using (var db = DbFactory.OpenDbConnection())
+ {
+ if (request.Delete == "reset")
+ {
+ db.DeleteAll<Rockstar>();
+ db.Insert(Rockstar.SeedData);
+ }
+ else if (request.Delete.IsInt())
+ {
+ db.DeleteById<Rockstar>(request.Delete.ToInt());
+ }
+
+ return new RockstarsResponse {
+ Aged = request.Age,
+ Total = db.GetScalar<int>("select count(*) from Rockstar"),
+ Results = request.Id != default(int) ?
+ db.Select<Rockstar>(q => q.Id == request.Id)
+ : request.Age.HasValue ?
+ db.Select<Rockstar>(q => q.Age == request.Age.Value)
+ : db.Select<Rockstar>()
+ };
+ }
+ }
+
+ public override object OnPost(Rockstars request)
+ {
+ using (var db = DbFactory.OpenDbConnection())
+ {
+ db.Insert(request.TranslateTo<Rockstar>());
+ return OnGet(new Rockstars());
+ }
+ }
+ }
+}
@@ -0,0 +1,29 @@
+@inherits ViewPage
+
+@{
+ Layout = "SimpleLayout";
+ ViewBag.Title = "Page with no model and no C# controller - just this page :)";
+ int age = 0;
+ var hasAge = Request.QueryString["Age"] != null && int.TryParse(Model.Age, out age);
+ var rockstars = hasAge
+ ? Db.Select<Rockstar>(q => q.Age == age)
+ : Db.Select<Rockstar>();
+ var title = hasAge ? "{0} year old rockstars".Fmt(age) : "All Rockstars";
+}
+
+<div>@title</div>
+<ul>
+ @foreach (var rockstar in rockstars) {
+ <li>@rockstar.FirstName - @rockstar.LastName (<a href="?Age=@rockstar.Age">@rockstar.Age</a>)</li>
+ }
+</ul>
+
+<p><a href="?">Show all Rockstars</a></p>
+
+<h3>Other Pages</h3>
+<div><a href="/rockstars">/rockstars</a></div>
+<div><a href="/TypedModelNoController">/TypedModelNoController</a></div>
+<div><a href="/NoModelNoController">/NoModelNoController</a></div>
+
+<h2>Razor View</h2>
+<script src="https://gist.github.com/3162494.js"></script>
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("RazorRockstars.Console")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("RazorRockstars.Console")]
+[assembly: AssemblyCopyright("Copyright © 2012")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("cd5475ca-d88f-4fab-a71f-1d35ea72bda7")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,10 @@
+## Requires sqlite3.dll module in same /bin directory as .exe or available in the OS System $PATH
+
+In VS.NET this is done by copying the sqlite3.dll for your architecture into your projects root path:
+
+for 32bit pc
+ - copy `\sqlite\x86\sqlite3.dll` to `\`
+or for 64bit
+ - copy `\sqlite\x64\sqlite3.dll` to `\`
+
+Then go to `\sqlite3.dll` properties (in VS.NET) and change the Build Action to: 'Copy if Newer'
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{30BA8DF9-4698-4051-B8E9-84C81E330E24}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RazorRockstars.Console</RootNamespace>
+ <AssemblyName>RazorRockstars.Console</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>
+ </TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ <CodeAnalysisIgnoreGeneratedCode>true</CodeAnalysisIgnoreGeneratedCode>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Mono.Data.Sqlite">
+ <HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.3\lib\net35\Mono.Data.Sqlite.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack">
+ <HintPath>..\packages\ServiceStack.3.9.2\lib\net40\ServiceStack.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Common">
+ <HintPath>..\packages\ServiceStack.Common.3.9.0\lib\net35\ServiceStack.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Interfaces">
+ <HintPath>..\packages\ServiceStack.Common.3.9.0\lib\net35\ServiceStack.Interfaces.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.OrmLite, Version=3.9.2.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.3\lib\net35\ServiceStack.OrmLite.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.OrmLite.Sqlite">
+ <HintPath>..\packages\ServiceStack.OrmLite.Sqlite.Mono.3.9.3\lib\net35\ServiceStack.OrmLite.Sqlite.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.OrmLite.SqlServer, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\ServiceStack.OrmLite.SqlServer.3.9.2\lib\ServiceStack.OrmLite.SqlServer.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Razor">
+ <HintPath>..\packages\ServiceStack.3.9.2\lib\net40\ServiceStack.Razor.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Redis">
+ <HintPath>..\packages\ServiceStack.Redis.3.9.0\lib\net35\ServiceStack.Redis.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.ServiceInterface">
+ <HintPath>..\packages\ServiceStack.3.9.2\lib\net40\ServiceStack.ServiceInterface.dll</HintPath>
+ </Reference>
+ <Reference Include="ServiceStack.Text, Version=3.9.0.0, Culture=neutral, processorArchitecture=MSIL">
+ <HintPath>..\packages\ServiceStack.Text.3.9.2\lib\net35\ServiceStack.Text.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Runtime.Serialization" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="AppHost.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="App.config" />
+ <EmbeddedResource Include="TypedModelNoController.cshtml" />
+ <EmbeddedResource Include="NoModelNoController.cshtml" />
+ <EmbeddedResource Include="Views\Rockstars.cshtml" />
+ <EmbeddedResource Include="Views\Shared\HtmlReport.cshtml" />
+ <EmbeddedResource Include="Views\Shared\SimpleLayout.cshtml" />
+ <EmbeddedResource Include="Views\_Layout.cshtml" />
+ <None Include="packages.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="README.txt" />
+ <Content Include="sqlite3.dll">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ </Content>
+ <Content Include="sqlite\x64\sqlite3.dll" />
+ <Content Include="sqlite\x86\sqlite3.dll" />
+ <Content Include="sqlite\x86\sqlite3.exe" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.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">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -0,0 +1,27 @@
+@inherits ViewPage<Rockstars>
+
+@{
+ Layout = "SimpleLayout";
+ ViewBag.Title = "Page with typed 'Rockstars' model and no C# controller";
+ var rockstars = Model.Age.HasValue
+ ? Db.Select<Rockstar>(q => q.Age == Model.Age.Value)
+ : Db.Select<Rockstar>();
+ var title = Model.Age.HasValue ? "{0} year old rockstars".Fmt(Model.Age) : "All Rockstars";
+}
+
+<div>@title</div>
+<ul>
+ @foreach (var rockstar in rockstars) {
+ <li>@rockstar.FirstName - @rockstar.LastName (<a href="?Age=@rockstar.Age">@rockstar.Age</a>)</li>
+ }
+</ul>
+
+<p><a href="?">Show all Rockstars</a></p>
+
+<h3>Other Pages</h3>
+<div><a href="/rockstars">/rockstars</a></div>
+<div><a href="/TypedModelNoController">/TypedModelNoController</a></div>
+<div><a href="/NoModelNoController">/NoModelNoController</a></div>
+
+<h2>Razor View</h2>
+<script src="https://gist.github.com/3162493.js"></script>
Oops, something went wrong.

0 comments on commit 0c9eab7

Please sign in to comment.