请问关于MIC .net Framework 4.5.1 安装失败的问题你解决了吗?
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了请问关于MIC .net Framework 4.5.1 安装失败的问题你解决了吗?相关的知识,希望对你有一定的参考价值。
如果解决了的话可以教我一下吗? 我也遇到了和你一样的问题,所有的方法都试了,还是无法安装
参考技术A 去官网下载mic 86位的安装,在安装4.5。 安装.net4.5失败的话会有提示,你根据提示安装相应的软件请问在 .NET Core 中如何让 Entity Framework Core 在日志中记录由 LINQ 生成的SQL语句?
using dotNET.Core;
using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Diagnostics; using System.Text; namespace dotNET.EFCoreRepository /// <summary> /// ef 日志 /// </summary> public class EFLoggerProvider : ILoggerProvider public ILogger CreateLogger(string categoryName) => new EFLogger(categoryName); public void Dispose() /// <summary> /// /// </summary> public class EFLogger : ILogger private readonly string categoryName; public EFLogger(string categoryName) => this.categoryName = categoryName; public bool IsEnabled(LogLevel logLevel) => true; public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter) //ef core执行数据库查询时的categoryName为Microsoft.EntityFrameworkCore.Database.Command,日志级别为Information if (categoryName == "Microsoft.EntityFrameworkCore.Database.Command" && logLevel == LogLevel.Information) var logContent = formatter(state, exception); NLogger.Debug(logContent); //TraceMessage("Something happened."); // NLogger.Info(GetCodeLineAndFileName()); //TODO: 拿到日志内容想怎么玩就怎么玩吧 Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(logContent); Console.ResetColor(); public IDisposable BeginScope<TState>(TState state) => null; public void TraceMessage(string message, [System.Runtime.CompilerServices.CallerMemberName] string memberName = "", [System.Runtime.CompilerServices.CallerFilePath] string sourceFilePath = "", [System.Runtime.CompilerServices.CallerLineNumber] int sourceLineNumber = 0) NLogger.Debug("message: " + message); NLogger.Debug("member name: " + memberName); NLogger.Debug("source file path: " + sourceFilePath); NLogger.Debug("source line number: " + sourceLineNumber); public string GetCodeLineAndFileName() StackTrace insStackTrace = new StackTrace(true); var insStackFrames = insStackTrace.GetFrames(); string str = ""; foreach(var insStackFrame in insStackFrames) str += String.Format("\nFile: 0, Line: 1\n", insStackFrame.GetFileName(), insStackFrame.GetFileLineNumber()); return str;
第一步: 添加日志类
第二步:OnConfiguring 方法添加日志调用
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) var loggerFactory = new LoggerFactory(); loggerFactory.AddProvider(new EFLoggerProvider()); optionsBuilder.UseLoggerFactory(loggerFactory); base.OnConfiguring(optionsBuilder);
以上是关于请问关于MIC .net Framework 4.5.1 安装失败的问题你解决了吗?的主要内容,如果未能解决你的问题,请参考以下文章
请问.Net .Net Framework Asp.net分别是啥呢?
win7系统怎么安装Microsoft .NET Framework 4
请问在 .NET Core 中如何让 Entity Framework Core 在日志中记录由 LINQ 生成的SQL语句?