[英]Compile-time error with generative type provider
I've run into an issue with on a branch of FSharp.Data.SqlClient
I am working on with the generative SqlEnumProvider
type provider. 我正在使用生成的
SqlEnumProvider
类型提供程序在FSharp.Data.SqlClient
的分支上FSharp.Data.SqlClient
问题。 When the test project attemps to use a provided type, I get the following compile-time error: 当测试项目尝试使用提供的类型时,出现以下编译时错误:
A problem occurred writing the binary 'C:\\code\\FSharp.Data.SqlClient\\src\\SqlClient.Tests\\obj\\Debug\\net451\\SqlClient.Tests.dll': Error in pass3 for type FSharp.Data.EnumTests, error: Error in GetMethodRefAsMethodDefIdx for mref = ("Parse", "TinyIntMapping"), error: Exception of type 'Microsoft.FSharp.Compiler.AbstractIL.ILBinaryWriter+MethodDefNotFound' was thrown.
At design time, everything appears to be working as expected. 在设计时,一切似乎都按预期工作。 (I have intellisense on the provided types, etc.)
(我对所提供的类型有智慧,等等。)
I attempted the workaround suggested here , but no joy. 我尝试了此处建议的解决方法,但没有任何乐趣。
How about using the container approach where you place all of the provided types into a container, decanting each one you need? 如何使用容器方法将所有提供的类型放入容器中,然后倒出所需的每种容器?
I used this in quite a few of my type providers, have a look at the iOS designer type provider for reference: https://github.com/xamarin/fsharp-iOS-designer/blob/master/src/Xamarin.iOSProviders/iOSDesignerProvider.fs#L64-L86 我在很多类型提供程序中使用了此功能,请参阅iOS设计器类型提供程序以供参考: https : //github.com/xamarin/fsharp-iOS-designer/blob/master/src/Xamarin.iOSProviders/ iOSDesignerProvider.fs#L64-L86
It turns out the answer was in the sample template in the SDK, I just wasn't reading it closely enough: 事实证明答案是在SDK的示例模板中,我只是没有足够仔细地阅读它:
SqlEnumProvider
) should be added to the executing assembly. SqlEnumProvider
)应添加到执行程序集。 SqlEnumProvider<"SELECT * FROM (VALUES(('One'), 1), ('Two', 2)) AS T(Tag, Value)">
) should be added to the provided assembly. SqlEnumProvider<"SELECT * FROM (VALUES(('One'), 1), ('Two', 2)) AS T(Tag, Value)">
)应添加到提供的程序集中。 In the failing code, we were adding the root types to both assemblies. 在失败的代码中,我们将根类型添加到两个程序集中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.