Hi!

There is no built-in default object currently, but I have tested and this worked for me (with a server-side fragment that does not contain any client-side controls that would need resource context)

1
2
3
4
5
6
7
8
9
10
11
let dummyCtx =
    { new WebSharper.Web.Context() with
        member this.RootFolder = failwith "Unsupported"
        member this.RequestUri = failwith "Unsupported"
        member this.UserSession = failwith "Unsupported"
        member this.Environment = failwith "Unsupported"
        member this.Json = failwith "Unsupported"
        member this.Metadata = failwith "Unsupported"
        member this.Dependencies = failwith "Unsupported"
        member this.ApplicationPath = failwith "Unsupported"
        member this.ResourceContext = failwith "Unsupported" }

Also I have used ServerLoad.Once like this:

1
type MainTemplate = Templating.Template<"Main.html", serverLoad = ServerLoad.Once>

Otherwise the templating engine tries to create a FileSystemWatcher to respond to file changes, and this uses ctx.RootFolder if the file path is not fully specified.

Hope this helps!

By on 3/11/2019 6:38 AM ()

Good solution, thank you very much!

By on 3/11/2019 9:44 AM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper