2

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?

asked Jun 26, 2015 at 20:08

1 Answer 1

2

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)
    
answered Jun 27, 2015 at 0:32

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.