.NET Framework迁移.NET Core记录
程序员文章站
2024-01-21 20:49:16
...
1.反射
//AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);//原代码
AssemblyBuilder assemblyBuilder = AssemblyBuilder.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
2.上传文件
原代码:HttpPostedFileBase
替换为:IFormFile
需引用:Microsoft.AspNetCore.Http.Features.dll 3.1.9
可参考:https://www.cnblogs.com/leoxuan/articles/11087121.html
3. 当前路径
原代码:HttpContext.Current.Server.MapPath(upUrl)
替换为:AppContext.BaseDirectory
4.判断是否手机端
private static readonly Regex b = new Regex(@"(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino", RegexOptions.IgnoreCase | RegexOptions.Multiline)
推荐阅读
-
.NET Framework 的system.diagnostics
-
Net Framework,Net Core 和 Net Standard 区别
-
[转]ASP.NET Core 1.0: Using Entity Framework Core 1.0 - Transaction
-
.Net Framework和.Net Core 如何读取本地文件
-
.NET Framework迁移.NET Core记录
-
[转] .NET Framework 4 正则表达式
-
安装.NET Core
-
centos7下安装golang环境和.net core环境和docket环境
-
.net core 安装Swagger
-
.net core swagger安装