New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I can't insert a row in a sqlserver table. I get a "Enlisting in Ambiant transactions is not supported yet" #495
Comments
Ok, sounds like a missing feature of .NET Core. let ctx =
db.GetDataContext(
{ Timeout = TimeSpan.MaxValue;
IsolationLevel = Transactions.IsolationLevel.DontCreateTransaction
}:FSharp.Data.Sql.Transactions.TransactionOptions) edit: added type annotation |
open FSharp.Data.Sql.Transactions |
Ok, that works. Last question how do i parse in the runtimeconnection string then? If I do: and then I will basically open an second datacontext and run into the same error |
There is an override with 2 params: let ctx =
db.GetDataContext(
runtimeconnectionString,
{ Timeout = TimeSpan.MaxValue;
IsolationLevel = Transactions.IsolationLevel.DontCreateTransaction
}) |
Awesome. Thank you! I could add that to the docs if you want? |
That would be nice. |
Description
I can't insert a row in a sql table on ASP.NetCore 2.0
Repro steps
Like this:
let saveReportdefinitiion (report:Reportdefinition) =
try
let dc = sql.GetDataContext()
use ts = new TransactionScope()
let newReport = dc.Dbo.Berichtsdefinitionen.Create ()
newReport.BerichtsId <- report.Berichtsid
newReport.Berichtsname <- Some report.Berichtsname
...
Expected behavior
I expect the framework to insert a row in the database.
Actual behavior
I get this error:
An unhandled exception has occurred while executing the request. System.NotSupportedException: Enlisting in Ambient transactions is not supported.
at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry)
at System.Data.SqlClient.SqlConnection.Open()
at FSharp.Data.Sql.Providers.MSSqlServerProvider.FSharp-Data-Sql-Common-ISqlProvider-GetColumns(IDbConnection con, Table table) at FSharp.Data.Sql.Runtime.SqlDataContext.FSharp-Data-Sql-Common-ISqlDataContext-CreateEntity(String tableName) at EnergyDashboard.BackEnd.Common.Crudsql.createReport(Reportdefinition report, Object dc)
Related information
The text was updated successfully, but these errors were encountered: