GithubHelp home page GithubHelp logo

synnotech-ag / synnotech.mssqlserver Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 223 KB

Provides common functionality for database access to MS SQL Server.

License: MIT License

C# 99.86% Batchfile 0.14%
mssql database-access database helpers-library

synnotech.mssqlserver's People

Contributors

feo2x avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

synnotech.mssqlserver's Issues

Sometimes I get an exception in ExecuteNonQueryAndDisposeAsync

We run our tests nightly and sometimes one test fails because of a System.Data.SqlClient.SqlException in the method DropAndCreateDatabaseAsync.

System.Data.SqlClient.SqlException : Only user processes can be killed.
Stack Trace:
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
   at System.Data.SqlClient.SqlCommand.EndExecuteNonQuery(IAsyncResult asyncResult)
   at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location ---
   at Synnotech.MsSqlServer.Database.ExecuteNonQueryAndDisposeAsync(SqlCommand command, CancellationToken cancellationToken)
   at Synnotech.MsSqlServer.Database.ExecuteNonQueryAndDisposeAsync(SqlCommand command, CancellationToken cancellationToken)
   at Synnotech.MsSqlServer.Database.DropAndCreateDatabaseAsync(String connectionString, CancellationToken cancellationToken)
   at Synnotech.MsSqlServer.Database.DropAndCreateDatabaseAsync(String connectionString, CancellationToken cancellationToken)

Use SetSingleUser when dropping databases

Currently, we kill all database connections (more specifically, the user sessions) when we try to drop a database. While we do not need to check if a database exists, we might end up with non-user sessions that are still connected to the database after the kill command that prevent the drop of the database. We should switch to using SET SINGLE USER WITH ROLLBACK IMMEDIATE instead.

Implement Synnotech.DatabaseAbstractions

Synnotech.MsSqlServer currently does not implement Synnotech.DatabaseAbstractions. We should change this and at least implement IAsyncSession and IAsyncReadOnlySession.

Killing connections is not enough to detach the database

One of our users reported that while trying to detach, he encountered a SqlException that the object is currently in use.

I will try to go to single-user mode instead of killing all connections to fix this issue. This never occurred in my tests.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.