小编Dev*_*son的帖子

从EF CodeFirst迁移中删除表

首先要在EF代码中,从一个表中删除一列,然后再删除另一张表。

从类文件中删除一列后,将自动生成一个迁移文件。

但是如何删除表。

什么命令需要开火?我需要删除完整的类文件,还需要从上下文文件中删除以下行吗?

 public DbSet<TableClassName> TableClassNameSet { get; set; }
Run Code Online (Sandbox Code Playgroud)

我使用添加迁移“ TableClassName”命令。

那么删除表的最佳方法是什么?

c# sql-server entity-framework ef-code-first ef-migrations

5
推荐指数
3
解决办法
1万
查看次数

C#中Azure功能的Application Insight Logging

我们在C#中具有服务总线触发的Azure函数。我想在Application Insight中记录信息(例如调用的函数,结果,异常)。我已将TraceWriter转换为Ilogger以获取登录信息。我要实现的是在控制台(本地)以及Application Insight实例上进行日志记录。什么是实现此目标的完美方法?

    public static class AIFunction
{
    private static string key = TelemetryConfiguration.Active.InstrumentationKey = "************************";

    private static TelemetryClient telemetryClient =
        new TelemetryClient() { InstrumentationKey = key };

    [FunctionName("AIFunction")]
    public static void Run([ServiceBusTrigger("AIFunctionQueue", AccessRights.Manage, Connection = "ServiceBus")]string queueItem, ILogger log)
    {
        telemetryClient.Context.Cloud.RoleName = "AIFunction";
        log.LogInformation($"C# ServiceBus queue trigger function processed message: {queueItem}");
        log.LogInformation($"C# ServiceBus queue trigger function to test Application Insight Logging");
        telemetryClient.TrackEvent("AIFunction TrackEvent");
        telemetryClient.TrackTrace("AIFunction TrackTrace");
    }
}
Run Code Online (Sandbox Code Playgroud)

c# azure azure-application-insights azure-functions azure-functions-runtime

0
推荐指数
1
解决办法
3960
查看次数