小编Fre*_*sen的帖子

Bot Framework会破坏对话状态

我目前正在与微软的Bot Framework进行聊天机器人.在我的流程中,我有一个最终对话框,让用户知道他们正在参加比赛.对于未知输入,还有一种错误处理方法.这里有两种方法:

[Serializable]
public class ConcertCityDialog : AbstractBasicDialog<DialogResult>
{
    private static FacebookService FacebookService => new FacebookService(new FacebookClient());

    [LuisIntent("ConcertCity")]
    public async Task ConcertCityIntent(IDialogContext context, LuisResult result)
    {
        var fbAccount = await FacebookService.GetAccountAsync(context.Activity.From.Id);

        var selectedCityName = result.Entities.FirstOrDefault()?.Entity;

        concert_city selectedCity;
        using (var concertCityService = new ConcertCityService())
        {
            selectedCity = concertCityService.FindConcertCity(selectedCityName);
        }

        if (selectedCity == null)
        {
            await NoneIntent(context, result);
            return;
        }

        user_interaction latestInteraction;
        using (var userService = new MessengerUserService())
        {
            var user = userService.FindByFacebookIdIncludeInteractions(context.Activity.From.Id);
            latestInteraction = user.user_interaction.MaxBy(e => e.created_at);
        }

        latestInteraction.preferred_city_id = selectedCity.id; …
Run Code Online (Sandbox Code Playgroud)

c# chatbot botframework

16
推荐指数
1
解决办法
793
查看次数

在x轴上具有多级标签的图表

我正在创建一个VSTO加载项,其中包括为某些年度数据创建折线图.该数据每周包含数据点.我希望横轴可以按月分组,如下图所示:

在此输入图像描述

然而,我无法在VSTO文件中找到关于这是否可能的任何内容.据我所知,系列只为X轴采用一维值数组.有人对这个有经验么?

c# excel charts powerpoint vsto

10
推荐指数
1
解决办法
975
查看次数

在VSTO PowerPoint中创建地图图表

我正在尝试在PowerPoint中添加地图.

截至目前,我无法在XlChartType中看到这样做的选项,但是如果我手动插入一个,我可以检查插入的图表并看到其XlChartType的计算结果为140.

如果我尝试插入具有此类型的图表,我会按预期获得地图.但是,如果我尝试访问其工作簿,则会抛出异常.这两行代码应该解释我在做什么:

var chart = _slide.Shapes.AddChart((XlChartType)140).Chart;
var workbook = (Workbook)chart.ChartData.Workbook;
Run Code Online (Sandbox Code Playgroud)

我认为这与它没有得到官方支持的事实有关.有没有办法解决这个问题并编辑图表的数据?

c# powerpoint vsto

8
推荐指数
1
解决办法
116
查看次数

部署到Azure - 无法连接到数据库

我最近订阅了Azure免费试用版,我目前正在尝试发布我的网站.

但是,当我发布我的网站时,我遇到了以下错误:

[NullReferenceException: Object reference not set to an instance of an object.]
MySql.Data.MySqlClient.MySqlProviderServices.GetDbProviderManifestToken(DbConnection connection) +56
   System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection) +276
   System.Data.Entity.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +27
   System.Data.Entity.Infrastructure.<>c__DisplayClass1.<ResolveManifestToken>b__0(Tuple`3 k) +32
   System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory) +72
   System.Data.Entity.Infrastructure.DefaultManifestTokenResolver.ResolveManifestToken(DbConnection connection) +251
   System.Data.Entity.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +56
   System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +43
   System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
   System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +123
   System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +610
   System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
   System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +53
   System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
   System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +38
Run Code Online (Sandbox Code Playgroud)

当我使用连接字符串本地运行到我的远程数据库时,它工作正常,但是一旦我发布它就不起作用.

我的连接字符串如下所示:

<add name="DefaultConnection" connectionString="user id=****;password=****;persistsecurityinfo=False;server=**** ;database=iprospect_tools" providerName="MySql.Data.MySqlClient" />
<add name="ToolsEntities" connectionString="metadata=res://*/ToolsModel.csdl|res://*/ToolsModel.ssdl|res://*/ToolsModel.msl;provider=MySql.Data.MySqlClient;provider connection string=&quot;user id=****;password=****;persistsecurityinfo=False;server=****;database=tools&quot;" providerName="System.Data.EntityClient" />
Run Code Online (Sandbox Code Playgroud)

当我远程调试我的应用程序时,这是错误评估:

在此输入图像描述

知道可能导致此错误的原因是什么?

c# mysql entity-framework azure azure-web-sites

2
推荐指数
1
解决办法
302
查看次数