I'm trying to add a static constructor in a generative type provider:
let addStaticCtor (providedType: ProvidedTypeDefinition) =
let ctor = ProvidedConstructor([], invokeCode = fun _ -> <@@ printfn "hello" @@>)
ctor.IsTypeInitializer <- true
providedType.AddMember ctor
but the constructor is not generated. Is this the intended way to do it?
In previous versions, it was allowed to first specify the flag (IsTypeInitializer=true) and then setting the InvokeCode property, see for example this type provider.
I'm trying to add a static constructor in a generative type provider:
but the constructor is not generated. Is this the intended way to do it?
In previous versions, it was allowed to first specify the flag (
IsTypeInitializer=true
) and then setting theInvokeCode
property, see for example this type provider.What am I missing?