Skip to content

Commit

Permalink
Merge branch 'dotnet-6'
Browse files Browse the repository at this point in the history
  • Loading branch information
jacentino committed Sep 3, 2023
2 parents 4bbe0e1 + cb2e234 commit 40d1509
Show file tree
Hide file tree
Showing 43 changed files with 1,264 additions and 46 deletions.
41 changes: 41 additions & 0 deletions SqlFun.MsDataSql.Net6/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace SqlFun.MsDataSql.AssemblyInfo

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("SqlFun.MsDataSql")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("SqlFun")>]
[<assembly: AssemblyCopyright("Copyright © 2017")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[<assembly: Guid("194ea1bf-80f6-405c-8986-a4fef7cdfaa3")>]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("2.4.0.*")>]
[<assembly: AssemblyFileVersion("2.4.0.*")>]

do
()
22 changes: 22 additions & 0 deletions SqlFun.MsDataSql.Net6/SqlFun.MsDataSql.Net6.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DefineConstants>NET60;MS_DATA_SQLCLIENT</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="..\SqlFun\MsSql.fs" Link="MsSql.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SqlFun.Net6\SqlFun.Net6.fsproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<AssemblyName>SqlFun.MsDataSql</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SqlFun\AssemblyInfo.fs" />
<Compile Include="..\SqlFun.MsDataSql.Net6\AssemblyInfo.fs" Link="AssemblyInfo.fs" />
<Compile Include="..\SqlFun\MsSql.fs" />
</ItemGroup>
<ItemGroup>
Expand Down
41 changes: 41 additions & 0 deletions SqlFun.MsSql.NetStandard/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace SqlFun.AssemblyInfo

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("SqlFun.MsSql")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("SqlFun")>]
[<assembly: AssemblyCopyright("Copyright © 2017")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[<assembly: Guid("194ea1bf-80f6-405c-8986-a4fef7cdfaa3")>]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("2.4.0.*")>]
[<assembly: AssemblyFileVersion("2.4.0.*")>]

do
()
2 changes: 1 addition & 1 deletion SqlFun.MsSql.NetStandard/SqlFun.MsSql.NetStandard.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<AssemblyName>SqlFun.MsSql</AssemblyName>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\SqlFun\AssemblyInfo.fs" />
<Compile Include="AssemblyInfo.fs" />
<Compile Include="..\SqlFun\MsSql.fs" />
</ItemGroup>
<ItemGroup>
Expand Down
9 changes: 9 additions & 0 deletions SqlFun.MySqlConnector.Net6.Tests/App.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<connectionStrings>
<add name="SqlFunTests" connectionString="server=localhost;database=sqlfuntest;uid=jacenty;pwd=Mobutu-216;AllowLoadLocalInfile=True;" providerName="MySql" />
</connectionStrings>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>
41 changes: 41 additions & 0 deletions SqlFun.MySqlConnector.Net6.Tests/AssemblyInfo.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
namespace SqlFun.NpgSql.Tests.AssemblyInfo

open System.Reflection
open System.Runtime.CompilerServices
open System.Runtime.InteropServices

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[<assembly: AssemblyTitle("SqlFun.MySql.Tests")>]
[<assembly: AssemblyDescription("")>]
[<assembly: AssemblyConfiguration("")>]
[<assembly: AssemblyCompany("")>]
[<assembly: AssemblyProduct("SqlFun.MySqlConnector.Tests")>]
[<assembly: AssemblyCopyright("Copyright © 2023")>]
[<assembly: AssemblyTrademark("")>]
[<assembly: AssemblyCulture("")>]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[<assembly: ComVisible(false)>]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[<assembly: Guid("36916a8b-57f1-45fd-a088-6862c07758a0")>]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [<assembly: AssemblyVersion("1.0.*")>]
[<assembly: AssemblyVersion("1.0.0.0")>]
[<assembly: AssemblyFileVersion("1.0.0.0")>]

do
()
23 changes: 23 additions & 0 deletions SqlFun.MySqlConnector.Net6.Tests/Common.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace SqlFun.MySql.Tests

module Common =
open System.Configuration
open SqlFun
open SqlFun.Queries
open SqlFun.GeneratorConfig
open MySqlConnector

let createConnection () =
let config = ConfigurationManager.OpenExeConfiguration(System.Reflection.Assembly.GetExecutingAssembly().Location)
new MySqlConnection(config.ConnectionStrings.ConnectionStrings.["SqlFunTests"].ConnectionString)

let generatorConfig = createDefaultConfig createConnection

let run f = DbAction.run createConnection f

let runAsync f = AsyncDb.run createConnection f

let sql commandText = sql generatorConfig commandText

let proc name = proc generatorConfig name

84 changes: 84 additions & 0 deletions SqlFun.MySqlConnector.Net6.Tests/Data.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
namespace SqlFun.MySql.Tests

open System
open SqlFun
open Common

module Data =

type Comment = {
id: int
postId: int
parentId: int option
content: string
author: string
createdAt: DateTime
replies: Comment list
}

type Tag = {
postId: int
name: string
}

type PostStatus =
| [<EnumValue("N")>] New = 0
| [<EnumValue("P")>] Published = 1
| [<EnumValue("A")>] Archived = 2

type Post = {
id: int
blogId: int
name: string
title: string
content: string
author: string
createdAt: DateTime
modifiedAt: DateTime option
modifiedBy: string option
status: PostStatus
comments: Comment list
tags: Tag list
}

type Signature = {
author: string
createdAt: DateTime
modifiedAt: DateTime option
modifiedBy: string option
status: PostStatus
}

type Blog = {
id: int
name: string
title: string
description: string
owner: string
createdAt: DateOnly
modifiedAt: DateOnly option
modifiedBy: string option
posts: Post list
}


type UserProfile = {
id: string
name: string
email: string
avatar: byte array
}


open Data

module Tooling =

let getNumberOfBlogs: IDataContext -> int =
sql "select count(*) from blog"

let deleteAllButFirstBlog: IDataContext -> unit =
sql "delete from blog where id > 1"

let deleteAllUsers: IDataContext -> unit =
sql "delete from userprofile"
Loading

0 comments on commit 40d1509

Please sign in to comment.