Reputation: 71101
Is there a good example or explanation of how to crawl you Development version of your database once with the SqlDataConnection type provider declaration, but not run it on every compile? And what is the correct way to specify the connection as a string parameter instead of string literal?
Upvotes: 2
Views: 115
Reputation: 16792
How to avoid hitting the DB on every compile
Use the LocalSchemaFile
static parameter with ForceUpdate = false
. See this answer for more info.
How to avoid using a string literal for the connection string
Two options:
Put your connection string in app.config
and use ConnectionStringName
to point to it.
Use local schema file for compile-time, then pass an arbitrary connection string at runtime.
type NorthwndDb = SqlDataConnection<ForceUpdate=false, LocalSchemaFile="schema.dbml">
let db = NorthwndDb.GetDataContext(realConnectionStringHere)
Upvotes: 2