master
editor 6 months ago
commit c1e6700eca

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
IIS configuration sections.
For schema documentation, see
%IIS_BIN%\config\schema\IIS_schema.xml.
Please make a backup of this file before making any changes to it.
NOTE: The following environment variables are available to be used
within this file and are understood by the IIS Express.
%IIS_USER_HOME% - The IIS Express home directory for the user
%IIS_SITES_HOME% - The default home directory for sites

@ -0,0 +1,63 @@
6个操作MONGODB的API
一、源码描述
6个操作MongoDB的api
环境VS2022 MongoDB7.0.7
二、功能介绍
6个操作MongoDB的接口没有修改与删除的。
主要是尝试C#中MongoDB的操作。很棒很方便。
运行前先启动MongoDB服务创建用户与密码、demo数据库。
三、注意事项
1、在项目Program.cs修改数据库连接字符串执行数据库。
2、ctrl+F5运行即可。
作者: coderbest
如需获得该源码的视频、更新等更多资料请访问: https://www.51aspx.com/Code/CSharpMongoDBDemo
------------------------------------------------------------------------------------------------
源码服务专家
官网: https://www.51aspx.com
讨论圈: https://club.51aspx.com/
平台声明:
1.51Aspx平台上提供下载的资源为免费、共享、商业三类源码,其中免费和共享源码仅供个人学习和研究使用,商业源码请在相应的授权许可条件下使用;
2.51Aspx平台对提供下载的软件及其它资源不拥有任何权利,其版权归属源码合法拥有者所有;
3.著作权人发现本网站载有侵害其合法权益的内容或作品,请与我们联系( 登录官网与客服反馈或发送邮件到support@51Aspx.com
4.51Aspx平台不保证提供的下载资源的准确性、安全性和完整性;
友情提示:
一般数据库文件默认在 DB_51Aspx 文件夹下
默认账号密码一般均为51Aspx
关于源码使用常见问题及解决方案,请参阅: https://www.51aspx.com/Help

@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.1" />
<PackageReference Include="MongoDB.Driver" Version="2.24.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>

@ -0,0 +1,15 @@
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
using MongoDB.Driver;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())

@ -0,0 +1,15 @@
{
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:46910",
"sslPort": 0
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

@ -0,0 +1,15 @@
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v8.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v8.0": {
"MongoDB/1.0.0": {
"dependencies": {
"Microsoft.AspNetCore.OpenApi": "8.0.1",
"MongoDB.Driver": "2.24.0",
"Swashbuckle.AspNetCore": "6.4.0"
},
"runtime": {

@ -0,0 +1,15 @@
{
"runtimeOptions": {
"tfm": "net8.0",
"frameworks": [
{
"name": "Microsoft.NETCore.App",
"version": "8.0.0"
},
{
"name": "Microsoft.AspNetCore.App",
"version": "8.0.0"
}
],
"configProperties": {
"System.GC.Server": true,

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}

@ -0,0 +1,4 @@
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v8.0", FrameworkDisplayName = ".NET 8.0")]

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("MongoDB")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]

@ -0,0 +1,15 @@
// <auto-generated/>
global using global::Microsoft.AspNetCore.Builder;
global using global::Microsoft.AspNetCore.Hosting;
global using global::Microsoft.AspNetCore.Http;
global using global::Microsoft.AspNetCore.Routing;
global using global::Microsoft.Extensions.Configuration;
global using global::Microsoft.Extensions.DependencyInjection;
global using global::Microsoft.Extensions.Hosting;
global using global::Microsoft.Extensions.Logging;
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Net.Http.Json;

@ -0,0 +1,15 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
using System;
using System.Reflection;
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.OpenApi")]
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")]

@ -0,0 +1,15 @@
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\appsettings.Development.json
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\appsettings.json
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\MongoDB.exe
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\MongoDB.deps.json
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\MongoDB.runtimeconfig.json
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\MongoDB.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\MongoDB.pdb
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\Microsoft.AspNetCore.OpenApi.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\Microsoft.OpenApi.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\Swashbuckle.AspNetCore.Swagger.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\Swashbuckle.AspNetCore.SwaggerGen.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\bin\Debug\net8.0\Swashbuckle.AspNetCore.SwaggerUI.dll
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\obj\Debug\net8.0\MongoDB.csproj.AssemblyReference.cache
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\obj\Debug\net8.0\MongoDB.GeneratedMSBuildEditorConfig.editorconfig
C:\Users\coder\Desktop\111111\MongoDB1\MongoDB\obj\Debug\net8.0\MongoDB.AssemblyInfoInputs.cache

@ -0,0 +1,11 @@
{
"Version": 1,
"Hash": "5MU51a9qJdk7/ccfrts+J1e+TB3XxGDdGzYFHTl7UKg=",
"Source": "MongoDB",
"BasePath": "_content/MongoDB",
"Mode": "Default",
"ManifestType": "Build",
"ReferencedProjectsConfiguration": [],
"DiscoveryPatterns": [],
"Assets": []
}

@ -0,0 +1,15 @@
{
"format": 1,
"restore": {
"C:\\Users\\coder\\Desktop\\2024Code\\3\\20240325\\submit\\1\\MongoDB1\\MongoDB\\MongoDB.csproj": {}
},
"projects": {
"C:\\Users\\coder\\Desktop\\2024Code\\3\\20240325\\submit\\1\\MongoDB1\\MongoDB\\MongoDB.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "C:\\Users\\coder\\Desktop\\2024Code\\3\\20240325\\submit\\1\\MongoDB1\\MongoDB\\MongoDB.csproj",
"projectName": "MongoDB",
"projectPath": "C:\\Users\\coder\\Desktop\\2024Code\\3\\20240325\\submit\\1\\MongoDB1\\MongoDB\\MongoDB.csproj",
"packagesPath": "C:\\Users\\coder\\.nuget\\packages\\",
"outputPath": "C:\\Users\\coder\\Desktop\\2024Code\\3\\20240325\\submit\\1\\MongoDB1\\MongoDB\\obj\\",
"projectStyle": "PackageReference",

@ -0,0 +1,15 @@
{
"version": 3,
"targets": {
"net8.0": {
"AWSSDK.Core/3.7.100.14": {
"type": "package",
"compile": {
"lib/netcoreapp3.1/AWSSDK.Core.dll": {
"related": ".pdb;.xml"
}
},
"runtime": {
"lib/netcoreapp3.1/AWSSDK.Core.dll": {
"related": ".pdb;.xml"
}
Loading…
Cancel
Save