随笔分类 -  C#

摘要:ASP.NET CORE下日志NLOG使用 摘自《深入浅出ASP.NET CORE》 NUGET:NLog.Web.AspNetCore 4.9.0 根目录下nlog.config <?xml version="1.0" encoding="utf-8"?> <nlog xmlns="http:// 阅读全文
posted @ 2023-08-01 11:24 牛腩 阅读(34) 评论(0) 推荐(0)
摘要:NET7下EFCORE的通用增删查改类 代码摘录自《深入浅出ASP.NET CORE》 /// <summary> /// 所有仓储的约定,此接口仅作为约定,用于标识他们 /// </summary> /// <typeparam name="TEntity">传入仓储的实体模型</typepara 阅读全文
posted @ 2023-07-27 21:39 牛腩 阅读(237) 评论(0) 推荐(0)
摘要:NET7下显示验证码 nuget:Zkweb.system.drawing mac 下显示验证码还得 nuget:runtime.osx.10.10-x64.CoreCompat.System.Drawing public class VierificationCodeServices { /// 阅读全文
posted @ 2023-07-27 07:49 牛腩 阅读(27) 评论(0) 推荐(0)
摘要:ztree分类页面代码 后台代码: [Area("Adnn1n")] public class CategoryController : BaseController { private readonly DAL.Interface.ICategory dal; public CategoryCon 阅读全文
posted @ 2023-07-26 20:12 牛腩 阅读(22) 评论(0) 推荐(0)
摘要:kendo的下拉框树示例 后台代码: public static string GetTreeJson_kendo(List<Category> list) { List<TreeNode_kendo> list_return = new List<TreeNode_kendo>(); var to 阅读全文
posted @ 2023-07-26 19:02 牛腩 阅读(89) 评论(0) 推荐(0)
摘要:NET7中简单的登录判断基类 public class BaseController : Controller { public override void OnActionExecuting(ActionExecutingContext context) { base.OnActionExecut 阅读全文
posted @ 2023-07-26 10:27 牛腩 阅读(32) 评论(0) 推荐(0)
摘要:NET7下取客户IP WEB层建立以下类: //控制器中直接用即可取IP ViewBag.ip = HttpContext.GetClientIP(); public static class HttpContextExtension { public static string GetClient 阅读全文
posted @ 2023-07-26 03:12 牛腩 阅读(67) 评论(0) 推荐(0)
摘要:NET7中sqlsugar的使用 仿《深入浅出ASP.NET CORE》这书里的IRepository和RepositoryBase using SqlSugar; using System.Linq.Expressions; namespace WebApplication1.DAL { /// 阅读全文
posted @ 2023-07-17 23:46 牛腩 阅读(220) 评论(0) 推荐(0)
摘要:ner7下的html导出为pdf nuget引入dinktopdf,按github上的示例来弄即可:https://github.com/rdvojmoc/DinkToPdf/ mac下vs2022,net7测试,需要把https://github.com/rdvojmoc/DinkToPdf/bl 阅读全文
posted @ 2023-07-14 11:12 牛腩 阅读(56) 评论(0) 推荐(0)
摘要:ASP.NET MVC4 WEB API跨域 web.config文件里加些东西即可 <system.webServer> <httpProtocol> <customHeaders> <add name="Access-Control-Allow-Origin" value="*" /> <add 阅读全文
posted @ 2023-07-13 22:11 牛腩 阅读(76) 评论(0) 推荐(0)
摘要:.net core读取leancloud上的数据 public IActionResult Index() { try { string url = "https://xxxx.xxx.net/1.1/classes/guestbook?order=-createdAt&count=1"; stri 阅读全文
posted @ 2023-07-11 10:36 牛腩 阅读(66) 评论(0) 推荐(0)
摘要:EF Core在单独的类库中进行迁移 AppDbContext类放在DAL层,则需要在DAL层创建DbContextDesignTimeFactory.cs using Microsoft.EntityFrameworkCore.Design; using Microsoft.EntityFrame 阅读全文
posted @ 2023-07-09 08:13 牛腩 阅读(33) 评论(0) 推荐(0)
摘要:.net core下解压缩zip包 //解压文件 nuget:sharpcompress net7 mvc下测试通过 var zipPath = Path.Combine(hostingEnv.ContentRootPath, "wwwroot", "classtemp", "layuike.zip 阅读全文
posted @ 2023-07-09 08:11 牛腩 阅读(425) 评论(0) 推荐(0)
摘要:WPF中的Image控件上传,保存,显示头像 //选择电脑上的图片显示到Image控件中 private void btnUpload_Click(object sender, RoutedEventArgs e) { // 打开文件对话框以选择要上传的图片 OpenFileDialog openF 阅读全文
posted @ 2023-06-03 14:10 牛腩 阅读(692) 评论(0) 推荐(0)
摘要:WPF播放声音 用MediaElement控件,一个放完到下一个 <Window x:Class="WpfApp1_candel.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x 阅读全文
posted @ 2023-06-03 13:37 牛腩 阅读(93) 评论(0) 推荐(0)
摘要:WPF全局样式 Theme目录下建立Style.xaml文件 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft 阅读全文
posted @ 2023-05-31 14:35 牛腩 阅读(116) 评论(0) 推荐(0)
摘要:WPF窗体右上角叉叉退出应用程序 WPF窗体右上角叉叉退出应用程序 记得xaml里的Window标签响应Closing事件 private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if 阅读全文
posted @ 2023-05-31 14:19 牛腩 阅读(225) 评论(0) 推荐(0)
摘要:WPF中的密码框 XAML文件 <PasswordBox Name="PasswordBox" Margin="5" Padding="5" PreviewKeyDown="Txtpassword_PreviewKeyUp"/> 后台代码: IntPtr p = System.Runtime.Int 阅读全文
posted @ 2023-05-31 14:10 牛腩 阅读(119) 评论(0) 推荐(0)
摘要:2023年05月28日 VS2022 WFP .NETFramework,Version=v4.6.2 测试通过 NUGET:EntityFramework 6.4.4 , Microsoft.AspNet.Identity.EntityFramework 2.2.3 //扩展内置的identity 阅读全文
posted @ 2023-05-28 12:07 牛腩 阅读(179) 评论(0) 推荐(0)
摘要:2023-05-27测试 ,直接用百度文心一言搜索的,结果出来的代码能运行得通,不错不错 服务器端: using System.Net; using System.Net.Sockets; using System.Text; namespace tcpipdemo_server; class Pr 阅读全文
posted @ 2023-05-27 13:02 牛腩 阅读(54) 评论(0) 推荐(0)