diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 3729ff0..0000000 --- a/.dockerignore +++ /dev/null @@ -1,25 +0,0 @@ -**/.classpath -**/.dockerignore -**/.env -**/.git -**/.gitignore -**/.project -**/.settings -**/.toolstarget -**/.vs -**/.vscode -**/*.*proj.user -**/*.dbmdl -**/*.jfm -**/azds.yaml -**/bin -**/charts -**/docker-compose* -**/Dockerfile* -**/node_modules -**/npm-debug.log -**/obj -**/secrets.dev.yaml -**/values.dev.yaml -LICENSE -README.md \ No newline at end of file diff --git a/.github/workflows/replace.cs b/.github/workflows/replace.cs index a3d029b..0c8221c 100644 --- a/.github/workflows/replace.cs +++ b/.github/workflows/replace.cs @@ -1,7 +1,3 @@ TableServiceClient serviceClient = new( connectionString: "" ); - - TableClient client = serviceClient.GetTableClient( - tableName: "" - ); diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 104b544..0000000 --- a/.gitignore +++ /dev/null @@ -1,484 +0,0 @@ -## Ignore Visual Studio temporary files, build results, and -## files generated by popular Visual Studio add-ons. -## -## Get latest from `dotnet new gitignore` - -# dotenv files -.env - -# User-specific files -*.rsuser -*.suo -*.user -*.userosscache -*.sln.docstates - -# User-specific files (MonoDevelop/Xamarin Studio) -*.userprefs - -# Mono auto generated files -mono_crash.* - -# Build results -[Dd]ebug/ -[Dd]ebugPublic/ -[Rr]elease/ -[Rr]eleases/ -x64/ -x86/ -[Ww][Ii][Nn]32/ -[Aa][Rr][Mm]/ -[Aa][Rr][Mm]64/ -bld/ -[Bb]in/ -[Oo]bj/ -[Ll]og/ -[Ll]ogs/ - -# Visual Studio 2015/2017 cache/options directory -.vs/ -# Uncomment if you have tasks that create the project's static files in wwwroot -#wwwroot/ - -# Visual Studio 2017 auto generated files -Generated\ Files/ - -# MSTest test Results -[Tt]est[Rr]esult*/ -[Bb]uild[Ll]og.* - -# NUnit -*.VisualState.xml -TestResult.xml -nunit-*.xml - -# Build Results of an ATL Project -[Dd]ebugPS/ -[Rr]eleasePS/ -dlldata.c - -# Benchmark Results -BenchmarkDotNet.Artifacts/ - -# .NET -project.lock.json -project.fragment.lock.json -artifacts/ - -# Tye -.tye/ - -# ASP.NET Scaffolding -ScaffoldingReadMe.txt - -# StyleCop -StyleCopReport.xml - -# Files built by Visual Studio -*_i.c -*_p.c -*_h.h -*.ilk -*.meta -*.obj -*.iobj -*.pch -*.pdb -*.ipdb -*.pgc -*.pgd -*.rsp -*.sbr -*.tlb -*.tli -*.tlh -*.tmp -*.tmp_proj -*_wpftmp.csproj -*.log -*.tlog -*.vspscc -*.vssscc -.builds -*.pidb -*.svclog -*.scc - -# Chutzpah Test files -_Chutzpah* - -# Visual C++ cache files -ipch/ -*.aps -*.ncb -*.opendb -*.opensdf -*.sdf -*.cachefile -*.VC.db -*.VC.VC.opendb - -# Visual Studio profiler -*.psess -*.vsp -*.vspx -*.sap - -# Visual Studio Trace Files -*.e2e - -# TFS 2012 Local Workspace -$tf/ - -# Guidance Automation Toolkit -*.gpState - -# ReSharper is a .NET coding add-in -_ReSharper*/ -*.[Rr]e[Ss]harper -*.DotSettings.user - -# TeamCity is a build add-in -_TeamCity* - -# DotCover is a Code Coverage Tool -*.dotCover - -# AxoCover is a Code Coverage Tool -.axoCover/* -!.axoCover/settings.json - -# Coverlet is a free, cross platform Code Coverage Tool -coverage*.json -coverage*.xml -coverage*.info - -# Visual Studio code coverage results -*.coverage -*.coveragexml - -# NCrunch -_NCrunch_* -.*crunch*.local.xml -nCrunchTemp_* - -# MightyMoose -*.mm.* -AutoTest.Net/ - -# Web workbench (sass) -.sass-cache/ - -# Installshield output folder -[Ee]xpress/ - -# DocProject is a documentation generator add-in -DocProject/buildhelp/ -DocProject/Help/*.HxT -DocProject/Help/*.HxC -DocProject/Help/*.hhc -DocProject/Help/*.hhk -DocProject/Help/*.hhp -DocProject/Help/Html2 -DocProject/Help/html - -# Click-Once directory -publish/ - -# Publish Web Output -*.[Pp]ublish.xml -*.azurePubxml -# Note: Comment the next line if you want to checkin your web deploy settings, -# but database connection strings (with potential passwords) will be unencrypted -*.pubxml -*.publishproj - -# Microsoft Azure Web App publish settings. Comment the next line if you want to -# checkin your Azure Web App publish settings, but sensitive information contained -# in these scripts will be unencrypted -PublishScripts/ - -# NuGet Packages -*.nupkg -# NuGet Symbol Packages -*.snupkg -# The packages folder can be ignored because of Package Restore -**/[Pp]ackages/* -# except build/, which is used as an MSBuild target. -!**/[Pp]ackages/build/ -# Uncomment if necessary however generally it will be regenerated when needed -#!**/[Pp]ackages/repositories.config -# NuGet v3's project.json files produces more ignorable files -*.nuget.props -*.nuget.targets - -# Microsoft Azure Build Output -csx/ -*.build.csdef - -# Microsoft Azure Emulator -ecf/ -rcf/ - -# Windows Store app package directories and files -AppPackages/ -BundleArtifacts/ -Package.StoreAssociation.xml -_pkginfo.txt -*.appx -*.appxbundle -*.appxupload - -# Visual Studio cache files -# files ending in .cache can be ignored -*.[Cc]ache -# but keep track of directories ending in .cache -!?*.[Cc]ache/ - -# Others -ClientBin/ -~$* -*~ -*.dbmdl -*.dbproj.schemaview -*.jfm -*.pfx -*.publishsettings -orleans.codegen.cs - -# Including strong name files can present a security risk -# (https://github.com/github/gitignore/pull/2483#issue-259490424) -#*.snk - -# Since there are multiple workflows, uncomment next line to ignore bower_components -# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) -#bower_components/ - -# RIA/Silverlight projects -Generated_Code/ - -# Backup & report files from converting an old project file -# to a newer Visual Studio version. Backup files are not needed, -# because we have git ;-) -_UpgradeReport_Files/ -Backup*/ -UpgradeLog*.XML -UpgradeLog*.htm -ServiceFabricBackup/ -*.rptproj.bak - -# SQL Server files -*.mdf -*.ldf -*.ndf - -# Business Intelligence projects -*.rdl.data -*.bim.layout -*.bim_*.settings -*.rptproj.rsuser -*- [Bb]ackup.rdl -*- [Bb]ackup ([0-9]).rdl -*- [Bb]ackup ([0-9][0-9]).rdl - -# Microsoft Fakes -FakesAssemblies/ - -# GhostDoc plugin setting file -*.GhostDoc.xml - -# Node.js Tools for Visual Studio -.ntvs_analysis.dat -node_modules/ - -# Visual Studio 6 build log -*.plg - -# Visual Studio 6 workspace options file -*.opt - -# Visual Studio 6 auto-generated workspace file (contains which files were open etc.) -*.vbw - -# Visual Studio 6 auto-generated project file (contains which files were open etc.) -*.vbp - -# Visual Studio 6 workspace and project file (working project files containing files to include in project) -*.dsw -*.dsp - -# Visual Studio 6 technical files -*.ncb -*.aps - -# Visual Studio LightSwitch build output -**/*.HTMLClient/GeneratedArtifacts -**/*.DesktopClient/GeneratedArtifacts -**/*.DesktopClient/ModelManifest.xml -**/*.Server/GeneratedArtifacts -**/*.Server/ModelManifest.xml -_Pvt_Extensions - -# Paket dependency manager -.paket/paket.exe -paket-files/ - -# FAKE - F# Make -.fake/ - -# CodeRush personal settings -.cr/personal - -# Python Tools for Visual Studio (PTVS) -__pycache__/ -*.pyc - -# Cake - Uncomment if you are using it -# tools/** -# !tools/packages.config - -# Tabs Studio -*.tss - -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# Visual Studio History (VSHistory) files -.vshistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ - -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ - -# Fody - auto-generated XML schema -FodyWeavers.xsd - -# VS Code files for those working on multiple tools -.vscode/* -!.vscode/settings.json -!.vscode/tasks.json -!.vscode/launch.json -!.vscode/extensions.json -*.code-workspace - -# Local History for Visual Studio Code -.history/ - -# Windows Installer files from build outputs -*.cab -*.msi -*.msix -*.msm -*.msp - -# JetBrains Rider -*.sln.iml -.idea - -## -## Visual studio for Mac -## - - -# globs -Makefile.in -*.userprefs -*.usertasks -config.make -config.status -aclocal.m4 -install-sh -autom4te.cache/ -*.tar.gz -tarballs/ -test-results/ - -# Mac bundle stuff -*.dmg -*.app - -# content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore -# General -.DS_Store -.AppleDouble -.LSOverride - -# Icon must end with two \r -Icon - - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns -.com.apple.timemachine.donotpresent - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk - -# content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore -# Windows thumbnail cache files -Thumbs.db -ehthumbs.db -ehthumbs_vista.db - -# Dump file -*.stackdump - -# Folder config file -[Dd]esktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msix -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# Vim temporary swap files -*.swp diff --git a/Cosmos.Samples.Table.Quickstart.sln b/Cosmos.Samples.Table.Quickstart.sln deleted file mode 100644 index 29b3f4a..0000000 --- a/Cosmos.Samples.Table.Quickstart.sln +++ /dev/null @@ -1,22 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Samples.Table.Quickstart.Web", "web\Cosmos.Samples.Table.Quickstart.Web.csproj", "{F161D39F-F515-410A-9FE3-CA95A2659966}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F161D39F-F515-410A-9FE3-CA95A2659966}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F161D39F-F515-410A-9FE3-CA95A2659966}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F161D39F-F515-410A-9FE3-CA95A2659966}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F161D39F-F515-410A-9FE3-CA95A2659966}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 34432b0..0000000 --- a/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base -USER app -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["web/Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj", "web/"] -COPY ["models/Microsoft.Samples.Cosmos.Table.Quickstart.Models.csproj", "models/"] -COPY ["services/Microsoft.Samples.Cosmos.Table.Quickstart.Services.csproj", "services/"] -COPY ["Microsoft.Samples.Cosmos.Table.Quickstart.sln", "."] -RUN dotnet restore "Microsoft.Samples.Cosmos.Table.Quickstart.sln" -COPY . . -RUN dotnet build "Microsoft.Samples.Cosmos.Table.Quickstart.sln" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "web/Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Microsoft.Samples.Cosmos.Table.Quickstart.Web.dll"] \ No newline at end of file diff --git a/Microsoft.Samples.Cosmos.Table.Quickstart.sln b/Microsoft.Samples.Cosmos.Table.Quickstart.sln deleted file mode 100644 index b8a890f..0000000 --- a/Microsoft.Samples.Cosmos.Table.Quickstart.sln +++ /dev/null @@ -1,34 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Samples.Cosmos.Table.Quickstart.Models", "models\Microsoft.Samples.Cosmos.Table.Quickstart.Models.csproj", "{9123FB78-3427-478E-A4F5-831E2AEE6C29}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Samples.Cosmos.Table.Quickstart.Services", "services\Microsoft.Samples.Cosmos.Table.Quickstart.Services.csproj", "{1B1316D3-D325-475F-91A3-E21BB15A654C}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Samples.Cosmos.Table.Quickstart.Web", "web\Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj", "{F817FC49-82A3-48CA-AE89-FBB1DF4ED478}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9123FB78-3427-478E-A4F5-831E2AEE6C29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9123FB78-3427-478E-A4F5-831E2AEE6C29}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9123FB78-3427-478E-A4F5-831E2AEE6C29}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9123FB78-3427-478E-A4F5-831E2AEE6C29}.Release|Any CPU.Build.0 = Release|Any CPU - {1B1316D3-D325-475F-91A3-E21BB15A654C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {1B1316D3-D325-475F-91A3-E21BB15A654C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {1B1316D3-D325-475F-91A3-E21BB15A654C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {1B1316D3-D325-475F-91A3-E21BB15A654C}.Release|Any CPU.Build.0 = Release|Any CPU - {F817FC49-82A3-48CA-AE89-FBB1DF4ED478}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F817FC49-82A3-48CA-AE89-FBB1DF4ED478}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F817FC49-82A3-48CA-AE89-FBB1DF4ED478}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F817FC49-82A3-48CA-AE89-FBB1DF4ED478}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/models/Microsoft.Samples.Cosmos.Table.Quickstart.Models.csproj b/models/Microsoft.Samples.Cosmos.Table.Quickstart.Models.csproj deleted file mode 100644 index 9cd9630..0000000 --- a/models/Microsoft.Samples.Cosmos.Table.Quickstart.Models.csproj +++ /dev/null @@ -1,11 +0,0 @@ - - - net9.0 - enable - enable - - - - - - \ No newline at end of file diff --git a/models/Product.cs b/models/Product.cs deleted file mode 100644 index 67972d8..0000000 --- a/models/Product.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Azure; -using Azure.Data.Tables; - -namespace Microsoft.Samples.Cosmos.Table.Quickstart.Models; - -public record Product : ITableEntity -{ - public string RowKey { get; set; } = $"{Guid.NewGuid()}"; - - public string PartitionKey { get; set; } = String.Empty; - - public string Name { get; set; } = String.Empty; - - public int Quantity { get; set; } = 0; - - public decimal Price { get; set; } = 0.0m; - - public bool Clearance { get; set; } = false; - - public ETag ETag { get; set; } = ETag.All; - - public DateTimeOffset? Timestamp { get; set; } -}; diff --git a/services/DemoService.cs b/services/DemoService.cs deleted file mode 100644 index f032730..0000000 --- a/services/DemoService.cs +++ /dev/null @@ -1,91 +0,0 @@ -using Azure; -using Azure.Data.Tables; -using Microsoft.Samples.Cosmos.Table.Quickstart.Models; -using Microsoft.Samples.Cosmos.Table.Quickstart.Services.Interfaces; - -namespace Microsoft.Samples.Cosmos.Table.Quickstart.Services; - -public sealed class DemoService(TableServiceClient serviceClient) : IDemoService -{ - public string GetEndpoint() => $"{serviceClient.Uri.AbsoluteUri}"; - - public async Task RunAsync(Func writeOutputAync) - { - TableClient client = serviceClient.GetTableClient( - tableName: "cosmicworks-products" - ); - - await writeOutputAync($"Get table:\t{client.Name}"); - - { - Product entity = new() - { - RowKey = "68719518391", - PartitionKey = "gear-surf-surfboards", - Name = "Yamba Surfboard", - Quantity = 10, - Price = 300.00m, - Clearance = true - }; - - Response response = await client.UpsertEntityAsync( - entity: entity, - mode: TableUpdateMode.Replace - ); - - await writeOutputAync($"Upserted entity:\t{entity}"); - await writeOutputAync($"Status code:\t{response.Status}"); - } - - { - Product entity = new() - { - RowKey = "68719518371", - PartitionKey = "gear-surf-surfboards", - Name = "Kiama Classic Surfboard", - Quantity = 25, - Price = 790.00m, - Clearance = false - }; - - - Response response = await client.UpsertEntityAsync( - entity: entity, - mode: TableUpdateMode.Replace - ); - await writeOutputAync($"Upserted entity:\t{entity}"); - await writeOutputAync($"Status code:\t{response.Status}"); - } - - { - Response response = await client.GetEntityAsync( - rowKey: "68719518391", - partitionKey: "gear-surf-surfboards" - ); - - await writeOutputAync($"Read entity row key:\t{response.Value.RowKey}"); - await writeOutputAync($"Read entity:\t{response.Value}"); - await writeOutputAync($"Status code:\t{response.GetRawResponse().Status}"); - } - - { - string category = "gear-surf-surfboards"; - AsyncPageable results = client.QueryAsync( - product => product.PartitionKey == category - ); - - await writeOutputAync($"Ran query"); - - List entities = new(); - await foreach (Product product in results) - { - entities.Add(product); - } - - foreach (var entity in entities) - { - await writeOutputAync($"Found entity:\t{entity.Name}\t[{entity.RowKey}]"); - } - } - } -} \ No newline at end of file diff --git a/services/Interfaces/IDemoService.cs b/services/Interfaces/IDemoService.cs deleted file mode 100644 index 174b3f6..0000000 --- a/services/Interfaces/IDemoService.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Microsoft.Samples.Cosmos.Table.Quickstart.Services.Interfaces; - -public interface IDemoService -{ - Task RunAsync(Func writeOutputAync); - - string GetEndpoint(); -} \ No newline at end of file diff --git a/services/Microsoft.Samples.Cosmos.Table.Quickstart.Services.csproj b/services/Microsoft.Samples.Cosmos.Table.Quickstart.Services.csproj deleted file mode 100644 index 88924eb..0000000 --- a/services/Microsoft.Samples.Cosmos.Table.Quickstart.Services.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - net9.0 - enable - enable - - - - - - - - - \ No newline at end of file diff --git a/web/App.razor b/web/App.razor deleted file mode 100644 index d414dad..0000000 --- a/web/App.razor +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Not found - -

Sorry, there's nothing at this address.

-
-
-
diff --git a/web/Components/App.razor b/web/Components/App.razor deleted file mode 100644 index 82a568b..0000000 --- a/web/Components/App.razor +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - - - - Azure Cosmos DB for Table - - - - - - - - - - diff --git a/web/Components/Layout/MainLayout.razor b/web/Components/Layout/MainLayout.razor deleted file mode 100644 index 9710d5f..0000000 --- a/web/Components/Layout/MainLayout.razor +++ /dev/null @@ -1,13 +0,0 @@ -@inherits LayoutComponentBase - -
-

- Azure Cosmos DB for Table | .NET Quickstart -

- @Body - -
diff --git a/web/Components/Pages/Home.razor b/web/Components/Pages/Home.razor deleted file mode 100644 index 49897ce..0000000 --- a/web/Components/Pages/Home.razor +++ /dev/null @@ -1,97 +0,0 @@ -@page "/" -@using System.Text -@inject IDemoService demoService -@rendermode InteractiveServer - - - Azure Cosmos DB for Table | .NET Quickstart - - -
-    @ConsoleText
-
- -
- -
- -
- - - ENDPOINT: - - @demoService.GetEndpoint() - -
- -@code { - private StringBuilder _console = new(); - - private string ConsoleText - { - get => _console.ToString(); - } - - private bool RunAgainEnabled { get; set; } - - protected override async Task OnInitializedAsync() - { - await GenerateQueryDataAsync(); - } - - private async Task RunAgainAsync() - { - await GenerateQueryDataAsync(); - } - - private async Task GenerateQueryDataAsync() - { - await SetRunAgain(false); - await ClearConsoleAsync(); - - await WriteToConsoleAync("Current Status:\tStarting..."); - - await demoService.RunAsync(writeOutputAync: WriteToConsoleAync); - - await WriteToConsoleAync("Current Status:\tStopping..."); - await SetRunAgain(true); - } - - private async Task WriteToConsoleAync(string message) - { - _console.AppendLine(message); - await InvokeAsync(StateHasChanged); - } - - private async Task ClearConsoleAsync() - { - _console.Clear(); - await InvokeAsync(StateHasChanged); - } - - private async Task SetRunAgain(bool state) - { - RunAgainEnabled = state; - await InvokeAsync(StateHasChanged); - } -} - diff --git a/web/Components/Routes.razor b/web/Components/Routes.razor deleted file mode 100644 index 2f49ee3..0000000 --- a/web/Components/Routes.razor +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - Not found - -

Sorry, there's nothing at this address.

-
-
-
diff --git a/web/Components/_Imports.razor b/web/Components/_Imports.razor deleted file mode 100644 index 006255c..0000000 --- a/web/Components/_Imports.razor +++ /dev/null @@ -1,12 +0,0 @@ -@using System.Net.Http -@using System.Net.Http.Json -@using Microsoft.AspNetCore.Components.Forms -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using static Microsoft.AspNetCore.Components.Web.RenderMode -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.JSInterop -@using Microsoft.Samples.Cosmos.Table.Quickstart.Models -@using Microsoft.Samples.Cosmos.Table.Quickstart.Services.Interfaces -@using Microsoft.Samples.Cosmos.Table.Quickstart.Web -@using Microsoft.Samples.Cosmos.Table.Quickstart.Web.Components diff --git a/web/Cosmos.Samples.Table.Quickstart.Web.csproj b/web/Cosmos.Samples.Table.Quickstart.Web.csproj deleted file mode 100644 index 65de7df..0000000 --- a/web/Cosmos.Samples.Table.Quickstart.Web.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - net8.0 - enable - enable - 65c85440-31fd-4394-ae83-614ffddbb71f - Linux - - - - - - - \ No newline at end of file diff --git a/web/Dockerfile b/web/Dockerfile deleted file mode 100644 index c0018fe..0000000 --- a/web/Dockerfile +++ /dev/null @@ -1,25 +0,0 @@ -#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. - -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base -USER app -WORKDIR /app -EXPOSE 8080 -EXPOSE 8081 - -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build -ARG BUILD_CONFIGURATION=Release -WORKDIR /src -COPY ["web/Cosmos.Samples.Table.Quickstart.Web.csproj", "web/"] -RUN dotnet restore "./web/./Cosmos.Samples.Table.Quickstart.Web.csproj" -COPY . . -WORKDIR "/src/web" -RUN dotnet build "./Cosmos.Samples.Table.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/build - -FROM build AS publish -ARG BUILD_CONFIGURATION=Release -RUN dotnet publish "./Cosmos.Samples.Table.Quickstart.Web.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false - -FROM base AS final -WORKDIR /app -COPY --from=publish /app/publish . -ENTRYPOINT ["dotnet", "Cosmos.Samples.Table.Quickstart.Web.dll"] \ No newline at end of file diff --git a/web/MainLayout.razor b/web/MainLayout.razor deleted file mode 100644 index 02f3b0d..0000000 --- a/web/MainLayout.razor +++ /dev/null @@ -1,8 +0,0 @@ -@inherits LayoutComponentBase - -
-

- Azure Cosmos DB for Table | .NET Quickstart -

- @Body -
diff --git a/web/Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj b/web/Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj deleted file mode 100644 index 5750f87..0000000 --- a/web/Microsoft.Samples.Cosmos.Table.Quickstart.Web.csproj +++ /dev/null @@ -1,17 +0,0 @@ - - - net9.0 - enable - enable - 938c2273-843e-4d6e-98ce-7c6e979eba12 - - - - - - - - - - - \ No newline at end of file diff --git a/web/Models/Product.cs b/web/Models/Product.cs deleted file mode 100644 index 51ff22a..0000000 --- a/web/Models/Product.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Azure; -using Azure.Data.Tables; - -namespace Cosmos.Samples.Table.Quickstart.Web.Models; - -// -public record Product : ITableEntity -{ - public string RowKey { get; set; } = $"{Guid.NewGuid()}"; - - public string PartitionKey { get; set; } = String.Empty; - - public string Name { get; set; } = String.Empty; - - public int Quantity { get; set; } = 0; - - public decimal Price { get; set; } = 0.0m; - - public bool Clearance { get; set; } = false; - - public ETag ETag { get; set; } = ETag.All; - - public DateTimeOffset? Timestamp { get; set; } -}; -// diff --git a/web/Pages/Index.razor b/web/Pages/Index.razor deleted file mode 100644 index 4ec49df..0000000 --- a/web/Pages/Index.razor +++ /dev/null @@ -1,81 +0,0 @@ -@page "/" -@inject IDemoService demoService -@using System.Text - -
-    @_console.ToString()
-
- -
- -
- -
- - - ENDPOINT: - - @demoService.GetEndpoint() - -
- -@code { - private StringBuilder _console = new(); - - private bool _runAgainEnabled = false; - - protected override void OnInitialized() => GenerateQueryDataAsync(); - - private void RunAgain() => GenerateQueryDataAsync(); - - private async void GenerateQueryDataAsync() - { - await SetRunAgain(false); - await ClearConsoleAsync(); - - await WriteToConsoleAync("Current Status:\tStarting..."); - - await demoService.RunAsync(writeOutputAync: WriteToConsoleAync); - - await WriteToConsoleAync("Current Status:\tStopping..."); - await SetRunAgain(true); - - async Task WriteToConsoleAync(string message) - { - _console.AppendLine(message); - await InvokeAsync(StateHasChanged); - await Task.Delay(TimeSpan.FromSeconds(0.75)); - } - - async Task ClearConsoleAsync() - { - _console.Clear(); - await InvokeAsync(StateHasChanged); - } - - async Task SetRunAgain(bool state) - { - _runAgainEnabled = state; - await InvokeAsync(StateHasChanged); - } - } -} diff --git a/web/Pages/_Host.cshtml b/web/Pages/_Host.cshtml deleted file mode 100644 index 3f9af0d..0000000 --- a/web/Pages/_Host.cshtml +++ /dev/null @@ -1,33 +0,0 @@ -@page "/" -@using Microsoft.AspNetCore.Components.Web -@namespace Cosmos.Samples.Table.Quickstart.Web.Pages -@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers - - - - - - - - Azure Cosmos DB for Table | .NET Quickstart - - - - - - - - - - - - - diff --git a/web/Program.cs b/web/Program.cs deleted file mode 100644 index 99bf6a7..0000000 --- a/web/Program.cs +++ /dev/null @@ -1,37 +0,0 @@ -using Azure.Data.Tables; -using Azure.Identity; -using Microsoft.Samples.Cosmos.Table.Quickstart.Services; -using Microsoft.Samples.Cosmos.Table.Quickstart.Services.Interfaces; -using Microsoft.Samples.Cosmos.Table.Quickstart.Web.Components; - -var builder = WebApplication.CreateBuilder(args); - -builder.Services.AddRazorComponents().AddInteractiveServerComponents(); - -builder.Services.AddSingleton((_) => -{ - TableServiceClient serviceClient = new( - connectionString: "" - ); - - TableClient client = serviceClient.GetTableClient( - tableName: "" - ); - return client; -}); - -builder.Services.AddTransient(); - -var app = builder.Build(); - -app.UseDeveloperExceptionPage(); - -app.UseHttpsRedirection(); - -app.UseAntiforgery(); - -app.MapStaticAssets(); - -app.MapRazorComponents().AddInteractiveServerRenderMode(); - -app.Run(); diff --git a/web/Properties/launchSettings.json b/web/Properties/launchSettings.json deleted file mode 100644 index 6511432..0000000 --- a/web/Properties/launchSettings.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5220", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7228;http://localhost:5220", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } - } diff --git a/web/Services/DemoService.cs b/web/Services/DemoService.cs deleted file mode 100644 index 1691f1d..0000000 --- a/web/Services/DemoService.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Azure; -using Azure.Data.Tables; -using Azure.Data.Tables.Models; -using Cosmos.Samples.Table.Quickstart.Web.Models; - -internal interface IDemoService -{ - Task RunAsync(Func writeOutputAync); - - string GetEndpoint(); -} - -internal sealed class DemoService(TableClient client) : IDemoService -{ - public string GetEndpoint() => $"{client.Uri.AbsoluteUri}"; - - public async Task RunAsync(Func writeOutputAync) - { - await writeOutputAync($"Get table:\t{client.Name}"); - - { - // - Product entity = new() - { - RowKey = "68719518391", - PartitionKey = "gear-surf-surfboards", - Name = "Surfboard", - Quantity = 10, - Price = 300.00m, - Clearance = true - }; - - Response response = await client.UpsertEntityAsync( - entity: entity, - mode: TableUpdateMode.Replace - ); - // - await writeOutputAync($"Upserted entity:\t{entity}"); - await writeOutputAync($"Status code:\t{response.Status}"); - } - - { - Product entity = new() - { - RowKey = "68719518371", - PartitionKey = "gear-surf-surfboards", - Name = "Kiama Classic Surfboard", - Quantity = 25, - Price = 790.00m, - Clearance = false - }; - - - Response response = await client.UpsertEntityAsync( - entity: entity, - mode: TableUpdateMode.Replace - ); - await writeOutputAync($"Upserted entity:\t{entity}"); - await writeOutputAync($"Status code:\t{response.Status}"); - } - - { - // - Response response = await client.GetEntityAsync( - rowKey: "68719518391", - partitionKey: "gear-surf-surfboards" - ); - // - await writeOutputAync($"Read entity row key:\t{response.Value.RowKey}"); - await writeOutputAync($"Read entity:\t{response.Value}"); - await writeOutputAync($"Status code:\t{response.GetRawResponse().Status}"); - } - - { - // - string category = "gear-surf-surfboards"; - AsyncPageable results = client.QueryAsync( - product => product.PartitionKey == category - ); - // - await writeOutputAync($"Ran query"); - - // - List entities = new(); - await foreach (Product product in results) - { - entities.Add(product); - } - // - - foreach (var entity in entities) - { - await writeOutputAync($"Found entity:\t{entity.Name}\t[{entity.RowKey}]"); - } - } - } -} diff --git a/web/_Imports.razor b/web/_Imports.razor deleted file mode 100644 index 882ddec..0000000 --- a/web/_Imports.razor +++ /dev/null @@ -1,5 +0,0 @@ -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.JSInterop -@using Cosmos.Samples.Table.Quickstart.Web -@using Cosmos.Samples.Table.Quickstart.Web.Models diff --git a/web/appsettings.json b/web/appsettings.json deleted file mode 100644 index c5f5d9e..0000000 --- a/web/appsettings.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "DetailedErrors": true, - "Logging": { - "LogLevel": { - "Default": "Information", - "Microsoft.AspNetCore": "Warning" - } - }, - "AllowedHosts": "*" -} diff --git a/web/wwwroot/favicon.ico b/web/wwwroot/favicon.ico deleted file mode 100644 index 8e96706..0000000 Binary files a/web/wwwroot/favicon.ico and /dev/null differ