Skip to content

Commit 15f77e8

Browse files
Merge pull request #299 from smoothdeveloper/docs-fixes
Docs fixes
2 parents eeb7ab9 + cf2ecfb commit 15f77e8

File tree

9 files changed

+24
-24
lines changed

9 files changed

+24
-24
lines changed

docs/content/bulk load.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
(*** hide ***)
2-
#r @"..\..\src\SqlClient\bin\Debug\FSharp.Data.SqlClient.dll"
2+
#r @"..\..\bin\FSharp.Data.SqlClient.dll"
33
#r "System.Transactions"
44
open FSharp.Data
55
open System

docs/content/configuration and Input.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ For example, it can be handed over to DBA team for optimization. It's harder to
105105
are mixed together (LINQ).
106106
*)
107107

108-
let cmd = new SqlCommandProvider<"GetDate.sql", connStr>(connStr)
108+
let cmd = new SqlCommandProvider<const(SqlFile<"GetDate.sql">.Text), connStr>(connStr)
109109
cmd.Execute() |> ignore
110110

111111
(**

docs/content/dynamic local db.fsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(*** hide ***)
22
#r "../../bin/FSharp.Data.SqlClient.dll"
3-
#r "../../bin/Microsoft.SqlServer.Types.dll"
3+
#r "Microsoft.SqlServer.Types"
44

55
(**
66
Dynamic creation of offline MDF
@@ -13,7 +13,7 @@ Sometimes you don't want to have to be online just to compile your programs. Wit
1313
open FSharp.Data
1414

1515
[<Literal>]
16-
let connectionString=@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\git\Project1\Database1.mdf;Integrated Security=True;Connect Timeout=10"
16+
let connectionString = @"Data Source=(LocalDB)\v12.0;AttachDbFilename=C:\git\Project1\Database1.mdf;Integrated Security=True;Connect Timeout=10"
1717

1818
(**
1919
However, binary files like this are difficult to diff/merge when working with multiple developers. For this reason wouldn't it be nice
@@ -73,7 +73,7 @@ Then change your connection string to look like this
7373
*)
7474

7575
[<Literal>]
76-
let connectionStringForCompileTime = @"Data Source=(LocalDB)\v11.0;AttachDbFilename=" + __SOURCE_DIRECTORY__ + @"\Database1.mdf;Integrated Security=True;Connect Timeout=10"
76+
let connectionStringForCompileTime = @"Data Source=(LocalDB)\v12.0;AttachDbFilename=" + __SOURCE_DIRECTORY__ + @"\Database1.mdf;Integrated Security=True;Connect Timeout=10"
7777

7878
type Foo = SqlCommandProvider<"SELECT * FROM Foo", connectionStringForCompileTime>
7979

docs/content/reference architecture.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ END
103103
open FSharp.Data
104104

105105
[<Literal>]
106-
let adventureWorks = @"Data Source=(LocalDb)\v11.0;Initial Catalog=AdventureWorks2012;Integrated Security=True"
106+
let adventureWorks = @"Data Source=(LocalDb)\v12.0;Initial Catalog=AdventureWorks2012;Integrated Security=True"
107107

108108
[<Literal>]
109109
let euler17 = "

docs/content/setup.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
open FSharp.Data
66

77
[<Literal>]
8-
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2014;Integrated Security=True"
8+
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True"

docs/content/sqlenumprovider.quickstart.fsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ type Roles =
194194
SqlEnumProvider<"
195195
SELECT *
196196
FROM (VALUES(('Read'), 1), ('Write', 2), ('Admin', 4)) AS T(Name, Value)
197-
", @"Data Source=(LocalDb)\v11.0;Integrated Security=True", Kind = SqlEnumKind.CLI>
197+
", @"Data Source=(LocalDb)\v12.0;Integrated Security=True", Kind = SqlEnumKind.CLI>
198198

199199
type CustomAuthorizeAttribute(roles: Roles) =
200200
inherit AuthorizeAttribute()

docs/content/transactions.fsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
open FSharp.Data
55

66
[<Literal>]
7-
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2014;Integrated Security=True"
7+
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True"
88

99
(**
1010
Transactions
@@ -156,15 +156,15 @@ do
156156
HumanResources.Employee
157157
WHERE
158158
BusinessEntityID = @id
159-
", connectionString, ResultType.Tuples, SingleRow = true>()
159+
", connectionString, ResultType.Tuples, SingleRow = true>(connectionString)
160160

161161
jamesKramerId |> cmd.Execute |> Option.get
162162

163163
assert("Production Technician - WC60" = jobTitle)
164164

165165
let newJobTitle = "Uber " + jobTitle
166166

167-
use updatedJobTitle = new AdventureWorks.HumanResources.uspUpdateEmployeeHireInfo()
167+
use updatedJobTitle = new AdventureWorks.HumanResources.uspUpdateEmployeeHireInfo(connectionString)
168168
let recordsAffrected =
169169
updatedJobTitle.Execute(
170170
businessEntityID,
@@ -177,7 +177,7 @@ do
177177
)
178178

179179
let updatedJobTitle =
180-
use cmd = new AdventureWorks.dbo.ufnGetContactInformation()
180+
use cmd = new AdventureWorks.dbo.ufnGetContactInformation(connectionString)
181181
//Use ExecuteSingle on sproc/function generated types
182182
//if you're sure it return 0 or 1 rows
183183
let result = cmd.ExecuteSingle(PersonID = jamesKramerId)
@@ -247,7 +247,7 @@ do
247247
INSERT INTO Sales.CurrencyRate
248248
VALUES (@currencyRateDate, @fromCurrencyCode, @toCurrencyCode,
249249
@averageRate, @endOfDayRate, @modifiedDate)
250-
", connectionString>()
250+
", connectionString>(connectionString)
251251

252252
let today = DateTime.Now.Date
253253

docs/content/unit-testing.fsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
(*** hide ***)
22
#r @"..\..\bin\FSharp.Data.SqlClient.dll"
3-
#r @"..\..\packages\xunit.1.9.2\lib\net20\xunit.dll"
3+
#r @"..\..\packages\Test\xunit\lib\net20\xunit.dll"
44
#r "System.Transactions"
55
open FSharp.Data
66
open System
77

88
[<Literal>]
9-
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2014;Integrated Security=True"
9+
let connectionString = @"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True"
1010

1111
(**
1212
@@ -40,14 +40,14 @@ type IRepository =
4040
abstract GetSalesChampion: country: string -> option<GetSalesChampion.Record>
4141

4242
//Production implementation
43-
type Repository(?connectionString: string) =
43+
type Repository(connectionString: string) =
4444
interface IRepository with
4545
member __.GetEmployeesByLevel(orgLevel) =
46-
use cmd = new GetEmployeesByLevel()
46+
use cmd = new GetEmployeesByLevel(connectionString)
4747
cmd.Execute(orgLevel) |> Seq.toList
4848

4949
member __.GetSalesChampion( region) =
50-
use cmd = new GetSalesChampion()
50+
use cmd = new GetSalesChampion(connectionString)
5151
cmd.Execute(region)
5252

5353
//logic to test
@@ -74,7 +74,7 @@ module MyTests =
7474
else []
7575

7676
member __.GetSalesChampion( region) =
77-
use cmd = new GetSalesChampion()
77+
use cmd = new GetSalesChampion(connectionString)
7878
cmd.Execute(region)
7979
}
8080

docs/content/whatsnew.fsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ open FSharp.Data
66

77
[<Literal>]
88
let connectionString =
9-
@"Data Source=.;Initial Catalog=AdventureWorks2014;Integrated Security=True"
9+
@"Data Source=.;Initial Catalog=AdventureWorks2012;Integrated Security=True"
1010

1111
type DB = SqlProgrammabilityProvider<connectionString>
1212

@@ -27,7 +27,7 @@ do
2727
FROM Sales.vSalesPerson
2828
WHERE CountryRegionName = @regionName AND SalesYTD > @salesMoreThan
2929
ORDER BY SalesYTD
30-
">()
30+
">(connectionString)
3131
cmd.Execute(topN = 3L, regionName = "United States", salesMoreThan = 1000000M) |> printfn "%A"
3232

3333
(**
@@ -66,10 +66,10 @@ Access to command and record types
6666
Compare it with usage of ```SqlCommandProvider``` where generated command type aliased explicitly.
6767
*)
6868

69-
let cmd1 = DB.CreateCommand<"SELECT name, create_date FROM sys.databases">()
69+
let cmd1 = DB.CreateCommand<"SELECT name, create_date FROM sys.databases">(connectionString)
7070
// vs
7171
type Get42 = SqlCommandProvider<"SELECT name, create_date FROM sys.databases", connectionString>
72-
let cmd2 = new Get42()
72+
let cmd2 = new Get42(connectionString)
7373

7474
//access to Record type
7575
type Cmd2Record = Get42.Record
@@ -95,7 +95,7 @@ but auto-competition still chokes on multi-line definitions.
9595
A workaround is to provide explicit name for generated command type
9696
*)
9797

98-
let cmd3 = DB.CreateCommand<"SELECT name, create_date FROM sys.databases", TypeName = "Get42">()
98+
let cmd3 = DB.CreateCommand<"SELECT name, create_date FROM sys.databases", TypeName = "Get42">(connectionString)
9999
type Cmd3Record = DB.Commands.Get42.Record
100100

101101
(**

0 commit comments

Comments
 (0)