Comments (9)
I'm not very familiar with EF (and I hope SqlCmdProv continues to make it unnecessary for me to learn).
If I understand correctly currently in SqlCommandProvider:
either SqlCommand<... ConnectionStringName="blah" ...>
or SqlCommand<... ConnectionString="foo" ...>
and you are proposing a change to SqlCommand<... ConnectionInfo="(name= if a name, otherwise string)" ...>
Is this correct? And somehow a connection string can be shared between types so it is unnecessary to add it to every type, but if you want to override, either by name or string you can?
So far, working with Azure Websites, I want to use Name in all cases. If there were a way to set default name, and only override name when necessary, that would be advantageous (perhaps), otherwise ConnectionString is actually rather useless.
from fsharp.data.sqlclient.
@tachyus-dev my alter-ego
from fsharp.data.sqlclient.
Yes, I think you understood me correctly.
You be able to define string literal
[]
let conn = "name=AdventureWorks"
And use it to define commands either using shorter positional version
type MyCommand1 = SqlCommand<..., conn, ..>
or named parameters
type MyCommand1 = SqlCommand<..., ConnectionStringOrName = conn, ...>
Run-time override can be provide either via config file or some kind of factory that knows to pass down correct connection string to SqlCommand constructor.
I hope it will reduce typing.
In the latest version ConnectionStringName has default value "SqlCommandProvider" but I don't think it's good idea. Non-intuitive. With the new design it will be easy to define string literal and share it between multiple command definitions.
from fsharp.data.sqlclient.
Marginal improvement from my perspective, but the big win would be in completing docs and losing "experimental" from the project path :)
The way I operate it wouldn't save much typing because this is the kind of thing I repeatedly copy and paste a template and then add finishing touches.
from fsharp.data.sqlclient.
I understand it's minor improvement but still worth an effort. Those innocent copy-and-paste templates can get out of hand quickly.
I wanted to confirm it with you because it will be a breaking change though easy to fix.
Yes, I'm working on docs and trying to wrap up the project so it can be moved to release mode.
Let me talk to Don about Experimental namespace.
Also I want to improve connection string configuration via constructor too - customers complain it's far from optimal experience.
from fsharp.data.sqlclient.
Should be just a minor change for us.
from fsharp.data.sqlclient.
Go ahead and drop Experimental
from fsharp.data.sqlclient.
The simplified type declaration is definitely good, but it does not solve the massive code duplication as we start passing the same runtime connection string to all the commands' constructors (I assume we use runtime connection string that's retrieved not from App.config
).
I suggest generate Create
static member for all commands like this:
type SqlCommand(connectionString: string) =
static member Create connectionString = SqlCommand connectionString
Then we'll able to write a generic factory, similar to this one:
module DB =
let inline get< ^a when ^a: (static member Create: string -> ^a)> =
(^a: (static member Create: string -> ^a) MySettings.Default.Databases.Database1)
Usage:
[<Literal>]
let DB1 = "Data Source=localhost; Initial Catalog=DB; Integrated Security=True"
type Proc1 = SqlCommand<"dbo.Proc1", DB1, CommandType = CommandType.StoredProcedure>
type Proc2 = SqlCommand<"dbo.Proc2", DB1, CommandType = CommandType.StoredProcedure>
type Proc3 = SqlCommand<"dbo.Proc3", DB1, CommandType = CommandType.StoredProcedure>
DB.get<Proc1>.Execute(...)
DB.get<Proc2>.Execute(...)
DB.get<Proc3>.Execute(...)
from fsharp.data.sqlclient.
release 1.1.27
from fsharp.data.sqlclient.
Related Issues (20)
- Dacpac support info HOT 3
- "F# Formatting" link is broken
- Can't build/run from the commandline, but can from Visual Studio 2019 HOT 2
- Question: Creating a provider without an access to DB HOT 3
- SqlEnumProvider breaks VS 2019 HOT 2
- Not platform detection Fable HOT 1
- Build is broken without full VS installation
- Fixed length binary columns in user defined table types fail when constructed HOT 8
- Cannot use User Defined Table Types with the SqlCommandProvider HOT 5
- .NET 6 support HOT 6
- One line summary of the bug HOT 2
- TVP Column Ordering is incorrect as of version 2.1.0
- Cannot use parameter name more than once in a script HOT 3
- System.Data.SqlClient is not supported on this platform. HOT 5
- Conversion failed when using User Defined Table Types HOT 1
- Any 2023 tricks for running on Windows? HOT 3
- NullReferenceException in SqlConnection.UseLocally HOT 1
- Support for 'Active Directory Interactive' authentication HOT 3
- dotnet SDK projects using FSharp.Core version 7.0.0 breaks at runtime HOT 3
- SQL LIKE operation doesn't recognize variable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsharp.data.sqlclient.