15 Commits

Author SHA1 Message Date
Lewis Sanchez
a56cf5a277 Consolidate context request endpoints into a single request endpoint (#2205)
* Create new endpoint consolidating previous 2

* Clarify comment

* Removes two separate endpoints to get and generate

* Rename classes for get context request

* Update src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

* Update src/Microsoft.SqlTools.ServiceLayer/Metadata/MetadataService.cs

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

* Code review changes

* Throw exception and localize ex messages

---------

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
2023-09-05 15:56:35 -07:00
Lewis Sanchez
c0a0f27e49 Return context after it has been generated (#2194)
* Emit generate scripts complete event to client

* Rename Message to ErrorMessage

* Sets owner URI for complete params obj

* Setting complete flag explicitly

* Making errorMessage prop nullable

* Localizes error messages

* Return context scripts and remove script tabs

* Send event when script gen isn't needed

* Change notification to request endpoint

* test get context when context doesn't exist

* Stop reading old context files
2023-08-31 16:28:05 -07:00
Lewis Sanchez
08e855aa1d Implements Contextualization API into Azure Data Studio to get better query recommendations from extensions like Copilot (#2159)
* Add contract to get all metadata request

* Add new metadata service request endpoint

* Adds factory to make database server scripts

* Minor clean up

* Corrects filename typo

* Cleans up SmoScripterFactory

* Stubs out metadata cacher

* Method clean up

* Add writing and reading to script cache

* Cleans up request endpoint flow

* Add missing edge case when cache isn't empty

* Remove unused code

* Remove unneeded null check

* Read to end of stream

* Passes correct parameter to write cache

* Adds integration test to get all scripts

* Renames new request endpoint

* Rename request class to AllServerMetadataRequest

* Renames server metadata request endpoints

* Refresh cache and adjusts return obj type

* Clean up

* Assert table script generation

* Minor cache refresh adjustment

* Ensure test create table script is accurate

* Code review changes

* Additional code review changes

* Swap logger write for logger warning

* Renames generate request endpoint methods

* Remove unused using statement

* Remove unnecessary create table check

* Check if previous script file is valid for reuse

* Pascal case for method name

* Code review changes

* Fix PR issues

* Update doc comment

* Fixes tests after code review changes

* Fix failing int. test due to 30 day temp file expiry

* Generalize type names and update request endpoint

* Updates doc comment.

* Remove 'database' from type and method names

* Code review changes

* Code review changes

* Issues with background thread.

* Remove thread sleep for test reliability

* Remove reflection from int. tests
2023-08-22 12:28:32 -07:00
Aasim Khan
73c2a75fba Creating a new Sql Core project that stores OE classes. (#2165)
* init

* More fixes

* moving filters from contracts to core OE classes

* Fixing some tests

* More fixes and added doc comments

* Fixing tests

* Quick refactoring

* more cleanups

* cleanup

* Adding stateless OE

* Adding null checks

* Making group by schema independent of settings

* Fixing tests

* Removing node info from core oe code

* Fixing tests and moving OE code to its own project

* moving oe to own project

* Removing changes to Kusto

* Removing azure access token from service layer

* Fixing project description and title

* Fixing file name typo

* Removing unused  strings from service layer

* Fixing localized strings in tests
Adding comments to stateless OE

* Fixing stuff

* Update src/Microsoft.SqlTools.SqlCore/Microsoft.SqlTools.SqlCore.csproj

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

* Fixing project nesting

* Fixing more stuff and removing OE class

* Cleanup

* Code cleanup

* fixing oe service provider

* Fixing test name

* Remove using

* Update src/Microsoft.SqlTools.SqlCore/ObjectExplorer/SmoModel/SmoQueryContext.cs

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>

* Fixing syntax error

* Adding project to locproject

* Fixing stuff

* Fixing errors

* sorting usings

---------

Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
2023-08-16 22:11:35 -07:00
Chris LaFreniere
cccdbf0bef Address CA1829 (Avoiding Count LINQ method calls when equivalent + more efficient properties exist) (#1961)
* Address CA1829 (Avoid Count LINQ Method Calls)

* Remove other change

* CA1829 removal

* CA1829 (remove whitespace)
2023-03-23 21:06:49 -07:00
Karl Burtram
f288bee294 Make nullable warnings a per file opt-in (#1842)
* Make nullable warnings a per file opt-in

* Remove unneeded compiler directives

* Remove compiler directive for User Data
2023-02-03 18:10:07 -08:00
David Shiflet
839acf67cd Convert most tools service tests to nunit (#1037)
* Remove xunit dependency from testdriver

* swap expected/actual as needed

* Convert Test.Common to nunit

* port hosting unit tests to nunit

* port batchparser integration tests to nunit

* port testdriver.tests to nunit

* fix target to copy dependency

* port servicelayer unittests to nunit

* more unit test fixes

* port integration tests to nunit

* fix test method type

* try using latest windows build for PRs

* reduce test memory use
2020-08-05 13:43:14 -04:00
Soheil Alizadeh
887a499d2b Update Infrastructure (#961)
* Update form .NET Core 2.2 to .NET Core 3.1

- Global variable for projects
- Change TFMs from netcoreapp2.2 to netcoreapp3.1
- Update global.json
- Update build.json
- Remove direct framework cake TestCore task
- Update travis dotnet version
- Update azure pipline file
- Update vscode launch.json

* Add Central Package Management

* Fix xUnit Breaking Change for MemberData type

* Fix xUnit breaking change for duplicate test method name

* Fix Rang/Index type conflict with System.Rang/Index

* Update vscode tasks.json

* Change serviceHostExecutable path in ServiceTestDriver.cs

* Downgrade SDK version (https://github.com/appveyor/ci/issues/3440)

- Appveyor hasn't installed latest SDK therefore I downgrade it until they install it.

* Dump Microsoft.SqlServer.DACFx
2020-06-12 11:44:18 -07:00
Karl Burtram
427f0c11e8 Bump SMO and SqlClient to pickup Microsoft.Data.SqlClient fixes (#894)
* Revert "Revert to SMO with older SQLClient driver (#889)"

This reverts commit b763abae47.

* Bump SMO and SqlClient
2019-11-22 17:17:21 -08:00
Karl Burtram
b763abae47 Revert to SMO with older SQLClient driver (#889)
* Revert "Update SMO (#875)"

This reverts commit 96593d66e3.

* Revert "Switch Tools Service to new SMO and Microsoft.Data.SqlClient driver (#865)"

This reverts commit 9d140b53f3.

* Bump SMO to 160.1910315.0-preview
2019-11-04 13:00:45 -08:00
David Shiflet
9d140b53f3 Switch Tools Service to new SMO and Microsoft.Data.SqlClient driver (#865)
* switch to ambient props and targets files

* build against Microsoft.Data.SqlClient

* build tests

* fix test bug

* temporarily add SMO nuget to the repo

* update to released Microsoft.Data package
2019-09-17 17:51:19 -04:00
Leila Lali
eacc0111f0 Added functions to metadata list result (#568)
* added functions to be included in metadata list result
2017-12-11 15:20:36 -08:00
Karl Burtram
84ea045572 XEvent Profiler initial event handlers (#456)
* Bump SMO to 140.2.5 to pick-up private XEvent binaries

* Pick up SMO binaries from the build lab

* Add ProfilerService class placeholder

* Update SMO nuget package to include DB Scoped XEvents

* Stage changes

* Stage changes

* Update SMO to use RTM dependencies and remove separate SqlScript package

* Stage changes

* Iterate on profiler service

* Fix post-merge break in localization

* More refactoring

* Continue iterating on profiler

* Add test profiler listener

* Address a couple of the code review feedback

* Fix AppVeyor build break

* Use self-cleaning test file
2017-09-12 14:08:50 -07:00
Karl Burtram
a1aa3f8b4c Add table and view metadata messges (#296)
* Add SMO table property lookup event

* Fix a couple bugs in column metadata

* Add GetView metadata message
2017-03-28 16:30:46 +00:00
Karl Burtram
7ba2011a1e Initial metadata and scripting services (#280)
* Initial metadata service and scripting service files

* Simple metadata lookup with SMO objects

* Add metadata type class

* Remove SMO from metadata service.

* Cleanup metadata service SQL

* Initial MetadataService test

* Add scripting commands

* Add metadata test case

* Remove sleep used for testing

* Use random table name in metadata test

* Add scripting tests
2017-03-14 22:35:17 -07:00