Commit Graph

19 Commits

Author SHA1 Message Date
ranasaria
09652cccd1 Enhanced Logging for sqltoolsservice (#695)
This change modifies the logging framework within sqltoolservice.
Moves away from custom Logger object to start using .Net tracing framework. It supports for the static Trace and TraceSource way of logging. For all new code it is recommend that we log the log messages using the existing static Logger class, while the code changes will continue to route the older Trace.Write* calls from the process to same log listeners (and thus the log targets) as used by the Logger class. Thus tracing in SMO code that uses Trace.Write* methods gets routed to the same file as the messages from rest of SQLTools Service code.
Make changes to start using .Net Frameworks codebase for all logging to unify our logging story.
Allows parameter to set tracingLevel filters that controls what kinds of message make it to the log file.
Allows a parameter to set a specific log file name so if these gets set by external code (the UI code using the tools service for example) then the external code is aware of the current log file in use.
Adding unittests to test out the existing and improved logging capabilities.


Sequences of checkins in development branch:
* Saving v1 of logging to prepare for code review. Minor cleanup and some end to end testing still remains
* Removing local launchSettings.json files
* added support for lazy listener to sqltoolsloglistener and removed incorrect changes to comments across files in previous checkin
* Converting time to local time when writing entries to the log
* move the hosting.v2 to new .net based logging code
* removing *.dgml files and addding them to .gitignore
* fixing typo of defaultTraceSource
* Addressing pull request feedback
* Adding a test to verify logging from SMO codebase
* propogating changes to v1 sqltools.hosting commandoptions.cs to the v2 version
* Fixing comments on start and stop callstack methods and whitespaces
* Commenting a test that got uncommented by mistake
* addding .gitattributes file as .sql file was observed to be misconstrued as a binary file
2018-09-24 23:55:59 -07:00
Anthony Dresser
3c0a282333 Serialize Connection String (#680)
* add string serialization

* add unadded file

* changed code to be testable, added test

* moved test to correct location

* change to send undefined rather than error if the serialization fails

* update request name
2018-08-16 13:10:14 -07:00
Kevin Cunnane
42ee96f99f Fix Ops Studio issue 97 where query connection is dropped (#549)
- Fixes https://github.com/Microsoft/sqlopsstudio/issues/97.
- This should fix the bulk of the issues reported by users since it's the 1st use of this connection in the query code path.
- Implemented the fix in the connection service. This will always open a connection when calling `GetOrOpenConnection`. I cannot see a reason why the connection returned from this should ever be closed.
- resolve issues in both this code path and the edit data code path since both use this method.
2017-11-21 14:46:20 -08:00
Anthony Dresser
399b03cbd1 Add force change database logic (#519)
* add logic to close connections if changing fails

* added logic to close connections and reopen that fail to change (azure)

* expose connection map in connection info, change while to foreach

* removed unneeded code

* reworked logic to not depend on thrown errors

* added tests
2017-10-25 10:54:17 -07:00
Benjamin Russell
e9bc97e290 Edit Data: Better errors for possible truncation (#514)
* Fix to make sql exceptions surface properly to user (with important notes!)

* Adding support for detecting column size issues when updating a cell

* Adding unit tests for the exception on read scenario
2017-10-21 11:08:40 -07:00
Leila Lali
fecf56bce2 closing the default connections that are opned just for validating the connections. Added the feature to application name in the connection (#483) 2017-10-09 10:49:12 -07:00
Leila Lali
f09b9f4c30 Fixing the bug with connections on database make restore fail (#473)
* closing the connections that don't need to be open and keeping track of the connections that should stay open
2017-10-05 20:06:31 -07:00
Karl Burtram
60aad9cf7e Allow connections on non-default port (#462)
* Allow custom port

* Update unit tests for port property
2017-09-21 08:26:13 -07:00
Kevin Cunnane
01d7cde0e3 Add support for Dedicated Administrator Connection (#466)
* Prototype support for admin connection

* Added test and used correct default for ADMIN connection casing
2017-09-20 16:04:12 -07:00
Matt Irvine
b20529cced Enable changing database when connected with a connection string (#413)
This commit builds connection options using the connection string as a base, but allow other options to be overridden, which is how we change database. This commit also makes sure to copy the connection string when copying a connection, since that didn't happen before
2017-07-14 13:24:00 -07:00
Karl Burtram
5dcc82c3d6 Upgrade to net core 2.0 (#356)
* Initial .net core 2.0 conversion

* Convert a few more projects to .net core 2.0

* Convert a few more projects to .net core 2.0

* Fix build.cmd errors

* Add mising nuget package

* Remove dead code

* Add checked in references to workaround nuget package issues

* Update SLN file to refer to correct csproj files

* Rename applications to workaround .net core tooling bug

* Update nuget package with SQL Parser changes

* Add PreserveCompliationContext to avoid MEF bug

* Update smo version to pickup .net core 2 changes

* Pickup latest SMO changes to fix merge break

* Actually pickup correct SMO binaries

* Add support for SLES 12.2

* Fix break running archiving on Linux

* Revert "Add support for SLES 12.2"

This reverts commit 95cdb6d0e35a425be5c0081345d214079cbdc3db.

* Update to latest SMO build

* Install .Net Core 2 during install phase

* Move .Net Core install

* Try to reference dotnet.exe directly

* Fix code coverage script for CSPROJ instead of project.json

* Turn off test that is unreliable in AppVeyor builds.

* Fix appveyor.yml line feed.

* Turn off another flaky test failing in AppVeyor
2017-07-05 16:18:14 -07:00
Karl Burtram
2e9843cec1 Merge create db work in progress (#341)
* Port over initial block of create db implementation

* Test case placeholder

* In-progress work

* Stage changes to other machine

* Add database prototype strings

* Stage changes to other machine

* Stage changes

* Hook the database info into capabilities discovery

* Stage changes

* Update SMO to latest from ssms_main

* Various clean-ups

* Update localization files
2017-05-09 17:56:32 -07:00
Matt Irvine
fb239ac956 Support connecting with a connection string (#334)
- Add support for connecting with a connection string by passing it as one of the connection parameters
- If a connection string is present, it will override any other parameters that are present
2017-05-01 21:01:26 -07:00
Kevin Cunnane
f3bf330da6 Connect with different properties should actually change context (#307)
* Connect with different properties should actually change context
- Up to now, calling Connect for a previously-connected URI would disconnect, then reconnect ot the original (not new) target. WIth these changes we handle changes to database name or other key properties by updating the ConnectionInfo and connecting to the new target
- Some interesting scenarios are raised by our API, notably that an empty database name maps to the default DB (which we know nothing about). This limits the new feature such that only if the DB Name is specified, we'll change the connection. Hence 2 calls to an empty DB will not result in a DB change.

Additional changes:
- After discussion with Ben, we're simplifying the cancellation logic. He had made changes to support this, so the main update is that we dispose the token in the final block after its last use (hence avoiding a disposed exception) and clean up the number of Waits required since we already have async cancellation support
- Factored some logic such that the OnConnection callback isn't invoked until after we've updated the database name in the GetConnectionCompleteParams method. Again, this supports reporting the actual DB name instead of leaving it blank for default DB requests.

* PR comment fixes
2017-04-06 11:25:59 -07:00
Leila Lali
d81fa347e5 fixed an issue with setting a boolean option to string (#291)
* fixed an issue with setting an option which Boolean to string
2017-03-24 10:16:55 -07:00
Leila Lali
9e576dea92 Added options to connection parameter (#285)
* Added options to connection parameter
2017-03-21 13:22:29 -07:00
Kevin Cunnane
0f706f28ee Merge from Master 2017-03-06 17:56:04 -08:00
Karl Burtram
f00136cffb Fix namespaces for code moved to separate class libraries (#263)
* Create ServiceHost a service-specific class

* Renaming hosting namespace

* Rename credentials namespace

* Fix namespaces
2017-03-02 14:41:06 -08:00
Benjamin Russell
1166778249 Isolate Shared Test Code (#252)
The goal of this make sure that test code is correctly organized to ensure that test suites aren't dependent on each other.
* UnitTests get their own project now (renaming Microsoft.SqlTools.ServiceLayer.Test to Microsoft.SqlTools.ServiceLayer.UnitTests) which is about 90% of the changes to the files.
* IntegrationTests no longer depends on UnitTests, only Test.Common
* Any shared components from TestObjects that spins up a "live" connection has been moved to IntegrationTests Utility/LiveConnectionHelper.cs
* The dictionary-based mock file stream factory has been moved to Test.Common since it is used by UnitTests and IntegrationTests
    * Added a overload that doesn't take a dictionary for when we don't care about monitoring the storage (about 90% of the time)
* The RunIf* wrapper methods have been moved to Test.Common
* OwnerUri and StandardQuery constants have been moved to Test.Common Constants file

* Updating to latest SDK version available at https://www.microsoft.com/net/core#windowscmd

* Moving unit tests to unit test folder

* Changing namespaces to UnitTests

* Moving some constants and shared functionality into common project, making the UnitTests reference it

* Unit tests are working!

* Integration tests are working

* Updating automated test runs

* Fixing one last broken unit test

* Exposing internals for other projects

* Moving edit data tests to UnitTest project

* Applying refactor fixes to unit tests

* Fixing flaky test that wasn't awaiting completion
2017-03-02 13:00:31 -08:00