This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type ColumnSelector = { Name: string; ColumnName: string } | |
type RowSelector = { Name: string; RowName: string } | |
type SetValueArgs = { Name: string; RowName: string; ColumnName: string; Value: string } | |
type SetDefaultValueArgs = { Name: string; RowName: string; Value: string } | |
type Command = | |
| Create of string | |
| AddColumn of ColumnSelector |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* | |
WHAT'S GOING ON HERE?! | |
Sometimes you don't care about a particular type, you're interested in one field only, let's say `EntityId`. | |
Instead of using interface (which isn't even possible if don't own a type), | |
we can do structural typing in F# using SRTP and Active Patterns. | |
Active patterns are not required for this, but they do make code much easier to use. | |
*) | |
// So we have 2 types with field `EntityId: string`: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#if INTERACTIVE | |
#I @"C:\Tools\MongoDB-CSharp\MongoDB.Linq\bin\Debug" | |
#r "MongoDB.Driver.dll" | |
#r "MongoDB.Linq.dll" | |
#r "FSharp.PowerPack.Linq.dll" | |
#r "System.Core.dll" | |
#endif | |
open System | |
open MongoDB.Driver |