mirror of
https://github.com/Microsoft/sql-server-samples.git
synced 2025-12-08 14:58:54 +00:00
Merge pull request #153 from JocaPC/master
Updating ProductCatalog Demo
This commit is contained in:
@@ -7,4 +7,5 @@ obj/*
|
||||
*.log
|
||||
*.lock.json
|
||||
Properties/PublishProfiles/*
|
||||
appsettings.Development.json
|
||||
appsettings.Development.json
|
||||
appsettings.Production.json
|
||||
@@ -54,7 +54,6 @@ namespace ProductCatalog
|
||||
|
||||
// Add framework services.
|
||||
services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
||||
services.AddDistributedMemoryCache();
|
||||
services.AddSession();
|
||||
services.AddMvc();
|
||||
}
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"Belgrade.Sql.Client": "0.5.1",
|
||||
"Belgrade.Sql.Client": "0.5.2",
|
||||
"Microsoft.AspNetCore.Mvc": "1.0.0",
|
||||
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
|
||||
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
|
||||
"Microsoft.AspNetCore.Session": "1.0.0",
|
||||
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
|
||||
"Microsoft.Extensions.Caching.Memory": "1.0.0",
|
||||
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
|
||||
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
|
||||
"Microsoft.Extensions.Configuration.Json": "1.0.0",
|
||||
@@ -34,7 +33,6 @@
|
||||
},
|
||||
"net46": {
|
||||
"dependencies": {
|
||||
"Microsoft.Framework.Caching.Memory": "1.0.0-*"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -1,8 +1,39 @@
|
||||
|
||||
--Combine standard columns with JSON columns.
|
||||
--Combine standard columns with JSON columns.
|
||||
select Name,Color,Size,Price,Quantity,Data,Tags
|
||||
from Product
|
||||
|
||||
/* Basic Demo */
|
||||
|
||||
|
||||
-- Get List of products
|
||||
select ProductID, Name,Color,Size,Price,Quantity,
|
||||
JSON_VALUE(Data, '$.MadeIn') as MadeIn,
|
||||
JSON_QUERY(Tags) as Tags
|
||||
from Product
|
||||
FOR JSON PATH
|
||||
|
||||
-- Get Product details
|
||||
select Name,Color,Size,Price,Quantity
|
||||
from Product
|
||||
where ProductID = 17
|
||||
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
|
||||
|
||||
-- Insert new product
|
||||
declare @p nvarchar(4000) =
|
||||
N'{"Name":"NEW","Color":"Magenta","Size":"62",
|
||||
"Price":28.9900,"Quantity":80}'
|
||||
EXEC dbo.InsertProductFromJson @p
|
||||
|
||||
-- Update product
|
||||
declare @p nvarchar(4000) =
|
||||
N'{"Name":"HL Bottom Bracket","Price":121.4900,"Quantity":65}'
|
||||
|
||||
EXEC dbo.UpdateProductFromJson 28, @p
|
||||
|
||||
/* End Basic Demo */
|
||||
|
||||
/* Detailed Demo */
|
||||
|
||||
--Use JSON Data in queries
|
||||
select ProductID, Name, Color, Size, Price, Quantity, Data, Tags,
|
||||
JSON_VALUE(Data, '$.MadeIn') as MadeIn
|
||||
|
||||
Reference in New Issue
Block a user