2 Star 5 Fork 1

AnyShop/eShop

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

eShop Reference Application - "AdventureWorks"

A reference .NET application implementing an e-commerce website using a services-based architecture using .NET Aspire.

eShop Reference Application architecture diagram

eShop homepage screenshot

Getting Started

This version of eShop is based on .NET 9.

Previous eShop versions:

Prerequisites

Windows with Visual Studio

  • Install Visual Studio 2022 version 17.10 or newer.
    • Select the following workloads:
      • ASP.NET and web development workload.
      • .NET Aspire SDK component in Individual components.
      • Optional: .NET Multi-platform App UI development to run client apps

Or

  • Run the following commands in a Powershell & Terminal running as Administrator to automatically configure your environment with the required tools to build and run this application. (Note: A restart is required and included in the script below.)
install-Module -Name Microsoft.WinGet.Configuration -AllowPrerelease -AcceptLicense -Force
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
get-WinGetConfiguration -file .\.configurations\vside.dsc.yaml | Invoke-WinGetConfiguration -AcceptConfigurationAgreements

Or

  • From Dev Home go to Machine Configuration -> Clone repositories. Enter the URL for this repository. In the confirmation screen look for the section Configuration File Detected and click Run File.

Mac, Linux, & Windows without Visual Studio

Or

  • Run the following commands in a Powershell & Terminal running as Administrator to automatically configuration your environment with the required tools to build and run this application. (Note: A restart is required after running the script below.)
Install Visual Studio Code and related extensions
install-Module -Name Microsoft.WinGet.Configuration -AllowPrerelease -AcceptLicense  -Force
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
get-WinGetConfiguration -file .\.configurations\vscode.dsc.yaml | Invoke-WinGetConfiguration -AcceptConfigurationAgreements

Note: These commands may require sudo

Note: When running on Mac with Apple Silicon (M series processor), Rosetta 2 for grpc-tools.

Running the solution

[!WARNING] Remember to ensure that Docker is started

  • (Windows only) Run the application from Visual Studio:
  • Open the eShop.Web.slnf file in Visual Studio
  • Ensure that eShop.AppHost.csproj is your startup project
  • Hit Ctrl-F5 to launch Aspire
  • Or run the application from your terminal:
dotnet run --project src/eShop.AppHost/eShop.AppHost.csproj

then look for lines like this in the console output in order to find the URL to open the Aspire dashboard:

Login to the dashboard at: http://localhost:19888/login?t=uniquelogincodeforyou

You may need to install ASP.NET Core HTTPS development certificates first, and then close all browser tabs. Learn more at https://aka.ms/aspnet/https-trust-dev-cert

Azure Open AI

When using Azure OpenAI, inside eShop.AppHost/appsettings.json, add the following section:

  "ConnectionStrings": {
    "OpenAi": "Endpoint=xxx;Key=xxx;"
  }

Replace the values with your own. Then, in the eShop.AppHost Program.cs, set this value to true

bool useOpenAI = false;

Here's additional guidance on the .NET Aspire OpenAI component.

Use Azure Developer CLI

You can use the Azure Developer CLI to run this project on Azure with only a few commands. Follow the next instructions:

  • Install the latest or update to the latest Azure Developer CLI (azd).
  • Log in azd (if you haven't done it before) to your Azure account:
azd auth login
  • Initialize azd from the root of the repo.
azd init
  • During init:

    • Select Use code in the current directory. Azd will automatically detect the .NET Aspire project.
    • Confirm .NET (Aspire) and continue.
    • Select which services to expose to the Internet (exposing webapp is enough to test the sample).
    • Finalize the initialization by giving a name to your environment.
  • Create Azure resources and deploy the sample by running:

azd up

Notes:

  • The operation takes a few minutes the first time it is ever run for an environment.
  • At the end of the process, azd will display the url for the webapp. Follow that link to test the sample.
  • You can run azd up after saving changes to the sample to re-deploy and update the sample.
  • Report any issues to azure-dev repo.
  • FAQ and troubleshoot for azd.

Contributing

For more information on contributing to this repo, read the contribution documentation and the Code of Conduct.

Sample data

The sample catalog data is defined in catalog.json. Those product names, descriptions, and brand names are fictional and were generated using GPT-35-Turbo, and the corresponding product images were generated using DALL·E 3.

eShop on Azure

For a version of this app configured for deployment on Azure, please view the eShop on Azure repo.

MIT License Copyright (c) .NET Foundation and Contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

.NET 开发的电子商务网站,支持移动端和 Web 端访问。项目用 PostgreSQL 来管理商品、类目、下单系统,而购物车的数据则由 Redis 来管理。 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/anyshop/eshop.git
git@gitee.com:anyshop/eshop.git
anyshop
eshop
eShop
main

搜索帮助