I have been working on getting a sample for using XPO from F#. My first sample was easily created back in January this year:
#light
open DevExpress.Xpo
type Person = class
inherit XPObject as base
public new(session : Session) = { inherit XPObject(session);
name = string.Empty
}
val mutable private name : string
member public x.Name
with get() = x.name
and set(v) = x.name <- v
end
let person = new Person(XpoDefault.Session)
person.Name <- "Wally"
person.Save( ...
I was playing around a bit today with F#, trying to write some real code that interfaces with WPF. Here are a few things I found — very much a “note to self” thing, but if you happen to be interested, please comment or ask.
Number 1 - implementing interfaces that include events is a PITA
I was trying to implement INotifyPropertyChanged, which contains the event PropertyChanged. Eventually I found a working description in this forum thread. I’ve now implemented the interface and a helper …
I just spent a little while hunting down an interesting problem in a little F# app. I had a bunch of code in a single file and I was going to structure it a bit and move certain parts into separate files. I started out from some code like this:
namespace Sturm.MyNamespace
type ICommandLine = begin
abstract member Parts: string list
end
type IPlugin =
abstract member CanHandle: ICommandLine -> bool
abstract member Handle: ICommandLine -> unit
type blah =
val mutable dummy: ...