f# - 类型提供者:如何重新生成?

标签 f# type-providers

您将如何创建LINQ-TO-SQL类型提供程序,生成或/和重新生成类?

我刚刚在数据库中添加了一个新表,而类型提供程序无法确定这一点。我试图删除带有类型提供程序的行,然后再次键入它-没运气。我也试图做一个重建..仍然没有运气。

编辑:

我已经定义了类型提供程序,例如:

[<Generate>]
type dbSchema = SqlDataConnection<"conString">


并像这样使用它:

let ctx = dbSchema.GetDataContext()

最佳答案

您是对的-这似乎很棘手。我在脚本文件中使用SqlDataConnection类型提供程序,并且更新到目前为止我发现的架构的唯一方法是对连接字符串进行一些较小(无关)的更改。例如,在参数之一的=之后添加空格:

[<Generate>]
type Northwind = TypeProviders.SqlDataConnection
  <"data source=.\\sqlexpress;initial catalog=Northwind;integrated security=True">

[<Generate>]
type Northwind = TypeProviders.SqlDataConnection
  <"data source=.\\sqlexpress;initial catalog=Northwind;integrated security= True">

//                                                                          ^ here


该模式似乎是使用连接字符串作为键来缓存的,因此,如果将其更改回来,则会再次获得旧的模式。我猜这可能是一个错误,因此添加空格是一种可能的解决方法。

还有一个参数ForceUpdate,但这似乎没有任何作用,并且the documentation对此也没有多说。

关于f# - 类型提供者:如何重新生成?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7821260/

相关文章:

f# - F# 的 Freebase 提供程序存在问题

json - F# 数据 JSON 类型提供程序 : How to handle a JSON property that can be an array or a property?

sqlite - SQLite 的 F# 类型提供程序?

javascript - 使用 WebSharper 编译器编写 Node.js 应用程序

interface - 如何在 F# 中检查对象是否实现接口(interface)

f# - 如何比较深度嵌套的歧视工会?

f# - 在没有 SQL 类型提供程序的情况下连接到 SQL 数据库?

F# 与 IQueryable 联接

f# - 从 TypeProvider 引用 Newtonsoft.Json

ios - 在 F# 和 Xamarin 中将元组转换为数组