Comments (13)
More investigation required. It turned that ToString cannot be overridden for generated types. Confirmed with @v2_matveev. I'm not sure but I think it's limitation of provided types. StructuredFormatDisplayAttribute is not supported either.
from fsharp.data.sqlclient.
You mean "cannot be overridden for erased types?"
from fsharp.data.sqlclient.
Right.
from fsharp.data.sqlclient.
The issue cannot be addressed for erased types. Only for generated.
from fsharp.data.sqlclient.
The solution is to have the erased type's representation implement the ToString override. The representation should store enough schema inrformations to implement the ToString logic exactly as if you had provided a bespoke ToString override through generated code.
Similar techniques can work for debugging etc., i.e. provided a debugging display on the erased type representation http://bit.ly/HYG7F5
from fsharp.data.sqlclient.
@dsyme I tried ToString() override - it didn't work. I confirmed it with @v2m. He also said DebuggerDisplayAttribute won't work either. After some thinking I understood why.
from fsharp.data.sqlclient.
Did you do the override on the representation type (i.e. which is not a provided type, but a type you've defined in your runtime library?)
from fsharp.data.sqlclient.
Nope. I don't have representational type because I don't need one. Provided type erased to standard System.Data.SqlClient.SqlCommand. I got your point. I'll think about it. Maybe a good idea.
from fsharp.data.sqlclient.
@dsyme Sorry, I misunderstood your question. The source of problem was provided erased type that we use to represent rows as record with properties. It erased to array which is of course very efficient. Confusion was around a way option<_>.None value printed as .
[[|Some "rowID"; Some "NO"; Some "int"; null; Some 10uy|];
[|Some "districtID"; Some "NO"; Some "int"; null; Some 10uy|];
[|Some "districtName"; Some "NO"; Some "nvarchar"; Some 150; null|]; ...
So, it's not that bad. I thought I can fix it if there is an easy way to override ToString for provided type. Otherwise it's not worth an effort to create base run-time type only to override "ToString". Plus overhead comparing to arrays.
from fsharp.data.sqlclient.
Do you have any runtime component at all? thx
from fsharp.data.sqlclient.
Very little. Only something to represent typed DataTable
http://github.com/dmitry-a-morozov/FSharp.Data.SqlCommandTypeProvider/blob/master/src/SqlCommandTypeProvider/DataTable.fs
because I could not use
http://msdn.microsoft.com/en-us/library/bb358258.aspx
with erased types
Also, some extensions to types from SqlClient namespace.
http://github.com/dmitry-a-morozov/FSharp.Data.SqlCommandTypeProvider/blob/master/src/SqlCommandTypeProvider/SqlClient.Extensions.fs
from fsharp.data.sqlclient.
@dsyme It would be nice to have short post from you or other expert (Keith, Tomas or Vladimir) on structuring TP projects. Some sort of guidelines. Because it's bit confusing.
- Should TP projects always be split into run-time/design-time. XMR provider for example is one piece. What are clear advantages of having 2 parts?
- If broken into 2 parts should run-time refer to design-time (WMI provider) or opposite (like most other providers).
- There is some trickery around loading either design-time lib (I believe Keiths does it in WMI provider via saving MethodInfo refs) or run-time (via ResolveAssembly event).
Thanks.
from fsharp.data.sqlclient.
- I'd say that if you don't need to support multiple .NET profiles, don't botther spliting into 2 parts, the complexity will increase immensely, and the only upside you'll get is a slightly lighter runtime dll.
- Referencing other assemblies in a type provider is troublesome (see the recent discussions on twitter about powershell scripts in the R and Azure type providers). In both Fsharpx and FSharp.Data type providers, the design time assembly simply reincludes all the files from the runtime assembly, and there is no assembly reference.
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.