You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
4.0 KiB
Plaintext
133 lines
4.0 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "45dee299",
|
|
"metadata": {},
|
|
"source": [
|
|
"[//]: # (初始化文件)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 10,
|
|
"id": "cf33d207",
|
|
"metadata": {
|
|
"language_info": {
|
|
"name": "polyglot-notebook"
|
|
},
|
|
"polyglot_notebook": {
|
|
"kernelName": "csharp"
|
|
}
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"text/html": [
|
|
"<div><div></div><div></div><div><strong>Installed Packages</strong><ul><li><span>Microsoft.Extensions.Configuration, 9.0.6</span></li><li><span>Microsoft.Extensions.DependencyInjection, 9.0.6</span></li><li><span>Microsoft.Extensions.Http, 9.0.6</span></li><li><span>Microsoft.Extensions.Http.Polly, 9.0.6</span></li><li><span>Microsoft.Extensions.Logging, 9.0.6</span></li><li><span>Microsoft.Extensions.Logging.Console, 9.0.6</span></li><li><span>Microsoft.Net.Http.Headers, 9.0.6</span></li><li><span>Polly, 8.6.1</span></li><li><span>Refit, 8.0.0</span></li><li><span>Refit.HttpClientFactory, 8.0.0</span></li><li><span>RestSharp, 112.1.0</span></li><li><span>System.Net.Http.Json, 9.0.6</span></li></ul></div></div>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"// 引用NuGet包\n",
|
|
"#r \"nuget:System.Net.Http.Json, 9.0.6\"\n",
|
|
"#r \"nuget:Microsoft.Extensions.Configuration, 9.0.6\"\n",
|
|
"#r \"nuget:Microsoft.Extensions.DependencyInjection, 9.0.6\"\n",
|
|
"#r \"nuget:Microsoft.Extensions.Logging, 9.0.6\" \n",
|
|
"#r \"nuget:Microsoft.Extensions.Logging.Console, 9.0.6\"\n",
|
|
"#r \"nuget:Microsoft.Extensions.Http, 9.0.6\"\n",
|
|
"#r \"nuget:Microsoft.Net.Http.Headers, 9.0.6\"\n",
|
|
"\n",
|
|
"#r \"nuget:RestSharp, 112.1.0\"\n",
|
|
"#r \"nuget:Polly\"\n",
|
|
"#r \"nuget:Microsoft.Extensions.Http.Polly\"\n",
|
|
"#r \"nuget:Refit, 8.0.0\" \n",
|
|
"#r \"nuget:Refit.HttpClientFactory, 8.0.0\"\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 11,
|
|
"metadata": {
|
|
"language_info": {
|
|
"name": "polyglot-notebook"
|
|
},
|
|
"polyglot_notebook": {
|
|
"kernelName": "csharp"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"//全局命名空间\n",
|
|
"global using System.Collections;\n",
|
|
"global using System.Collections.Concurrent;\n",
|
|
"global using System.IO;\n",
|
|
"global using System.IO.Enumeration;\n",
|
|
"global using System.Linq;\n",
|
|
"global using System.Linq.Expressions;\n",
|
|
"global using System.Net;\n",
|
|
"global using System.Net.Http;\n",
|
|
"global using System.Net.Http.Json;\n",
|
|
"global using System.Text;\n",
|
|
"global using System.Threading;\n",
|
|
"global using System.Threading.Tasks;\n",
|
|
"\n",
|
|
"global using Microsoft.Extensions.DependencyInjection;\n",
|
|
"global using Microsoft.Extensions.DependencyInjection.Extensions;\n",
|
|
"global using Microsoft.Extensions.Logging;\n",
|
|
"global using Microsoft.Extensions.Logging.Console;\n",
|
|
"global using Microsoft.Extensions.Http.Logging;\n",
|
|
"\n",
|
|
"global using RestSharp;\n",
|
|
"global using RestSharp.Authenticators;\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 12,
|
|
"metadata": {
|
|
"language_info": {
|
|
"name": "polyglot-notebook"
|
|
},
|
|
"polyglot_notebook": {
|
|
"kernelName": "csharp"
|
|
}
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"//公共对象:类、方法、变量等\n",
|
|
"public static HttpClient SharedHttpClient { get; } = new HttpClient(){BaseAddress = new Uri(\"http://localhost:41434\")};\n",
|
|
"\n",
|
|
"public static RestClient SharedRestClient { get; } = new RestClient(\"http://localhost:41434\");"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": ".NET (C#)",
|
|
"language": "C#",
|
|
"name": ".net-csharp"
|
|
},
|
|
"language_info": {
|
|
"name": "polyglot-notebook"
|
|
},
|
|
"polyglot_notebook": {
|
|
"kernelInfo": {
|
|
"defaultKernelName": "csharp",
|
|
"items": [
|
|
{
|
|
"aliases": [],
|
|
"languageName": "csharp",
|
|
"name": "csharp"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|