小编Eld*_*dho的帖子

弹性搜索不使用Nest返回文档

我很新ElasticSearch.

我无法使用ElasticSearch我试过的几种方式进行搜索,似乎没有什么对我有用.

如果我使用感知铬工具包Sense扩展为chrome和查询GET /employee/_search?q=FirstName="Eldho"它它工作正常.

我已经看了这个答案,也不适合我.

无法使用Nest进行搜索

    protected ElasticClient Client;
    IndexName index = "employee";

    public ElasticSearchRepository(Uri elasticServerUri)
    {
        var connection = new ConnectionSettings(elasticServerUri).DefaultIndex("employee");
        this.Client = new ElasticClient(connection);

    }

    //This is how i create Index
    public void CreateIndex()
    {

        var settings = new IndexSettings();
        settings.NumberOfReplicas = 1;
        settings.NumberOfShards = 1;

        var indexstate = new IndexState();
        indexstate.Settings = settings;


        Client.CreateIndex(index, g => g.Index(index)
              .InitializeUsing(indexstate)
              .Mappings(j => j.Map<Employee>(h => h.AutoMap(1))));

    }

    public List<Employee> Search(string …
Run Code Online (Sandbox Code Playgroud)

c# elasticsearch nest

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

连接语句中的条件的Lambda

我必须Employee根据他们进行过滤department。我可以使用LINQ进行相同的操作。

Linqlambda编译以得到相同的结果。编译器Lambda expression在编译之前将查询表达式更改为等效表达式,因此生成的IL完全相同。资源

var deptCollection = new List<Dept>();
var employeeCollection = new List<Employee>();

employeeCollection.Add(new Employee { Id = 1, Name = "Eldho" });

deptCollection.Add(new Dept { DepetarmentName = "a", EmployeeId = 3 });
deptCollection.Add(new Dept { DepetarmentName = "a", EmployeeId = 1 });

var empinadept = (from e in employeeCollection
                  from dep in deptCollection
                  where e.Id == dep.EmployeeId
                  && dep.DepetarmentName == "a"
                  select e)
                 .ToList();
Run Code Online (Sandbox Code Playgroud)

我无法.Where在此Lambda中添加子句

var empindeptLamda …
Run Code Online (Sandbox Code Playgroud)

c# linq lambda

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

如何在ASP.NET MVC中使用Windows语音合成器

我试图使用System.Speech该类在ASP.NET mvc应用程序中生成语音。

[HttpPost]
public  ActionResult TTS(string text)
{
   SpeechSynthesizer speechSynthesizer = new SpeechSynthesizer();
   speechSynthesizer.Speak(text);
   return View();
}
Run Code Online (Sandbox Code Playgroud)

但是它给出了以下错误。

 System.InvalidOperationException: 'An asynchronous operation cannot be 
 Started at this time. Asynchronous operations may only be started within an 
 asynchronous handler or module or during certain events in the Page lifecycle. 
 If this exception occurred while executing a Page, ensure that the Page is
 marked <%@ Page Async="true" %>. 
 This exception may also indicate an attempt to call an "async void" …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-mvc async-await system.speech.recognition

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

mvvm light - 使用回调发送通知消息

我需要在我的视图模型中使用FolderBrowserDialog的结果,

CodeBehind.cs

 private static void SelectFolderDialog()
    {
        using (System.Windows.Forms.FolderBrowserDialog folderdialg = new System.Windows.Forms.FolderBrowserDialog())
        {
            folderdialg.ShowNewFolderButton = false;
            folderdialg.RootFolder = Environment.SpecialFolder.MyComputer;

            folderdialg.Description = "Load Images for the Game";
            folderdialg.ShowDialog();
            if (folderdialg.SelectedPath != null)
            {
                var notifypath = new GenericMessage<string>(folderdialg.SelectedPath);
                Messenger.Default.Send(notifypath);

            }
        }
Run Code Online (Sandbox Code Playgroud)

我正在计划的是,从View-model发送带回调的通知到视图,执行FolderBrowserDialog将Selected路径返回给视图模型.

如何使用MVVM-Light发送带回调/ NotificationWithAction的notificationmessage.请帮我一个样本,因为我是Wpf和MVVM-Light的新手.

任何帮助表示赞赏

c# wpf mvvm mvvm-light

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

OpenXML-为演示文稿中的幻灯片设置幻灯片布局

这是我用来创建演示文稿的代码。

我在这里尝试的是创建一张幻灯片并将形状插入其中并将幻灯片附加到已创建的演示文稿中。这很好用。

我的问题是如何设置插入幻灯片的布局。我的意思是这里的幻灯片布局是

slideLayoutpart.SlideLayout = new SlideLayout() {
    Type = SlideLayoutValues.VerticalTitleAndText
};
Run Code Online (Sandbox Code Playgroud)

我想将此布局设置为我的幻灯片。

我曾在此处使用幻灯片布局

Slide slide = new Slide(new CommonSlideData(new ShapeTree()));

uint drawingObjectId = 1;

// Construct the slide content.            
// Specify the non-visual properties of the new slide.
NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());
nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties() { Id = 1, Name = "" };
nonVisualProperties.NonVisualGroupShapeDrawingProperties = new NonVisualGroupShapeDrawingProperties();
nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();

// Specify the group shape properties of the new slide.
slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties()); …
Run Code Online (Sandbox Code Playgroud)

powerpoint openxml presentation openxml-sdk presentationml

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

如何在ftp中使用AzureDevOps发布asp.net网站

我希望使用 AzureDevOps 作为我的 CI/CD 工具来启用我的项目 (asp.net api) CI/CD。
我希望通过 FTP 将我发布的文件上传到我的托管提供商。

目前,当通过 Azure DevOps 构建产品时,它会将应用程序创建为 Msdeploy 文件。我的托管提供商不支持通过 ftp

建造

构建步骤

构建神器 在此输入图像描述

正如您所看到的构建工件,其格式为 Web 部署

发布 在此输入图像描述 尝试上传 zip 文件和 ms 部署文件的工件。

上传文件后,服​​务器不知道如何部署 msdeploy 项目文件。 如何使用 AzureDevOps 部署网站

期望文件上传到 ftp 在此输入图像描述

我想将文件作为 ftp 支持的常规文件上传,或者我想以自动方式执行 msdeploy

ftp publishing msdeploy azure-devops

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

Json datetime包含时间开始的T

为什么我的Json DateTime值在时间之前有T.

  1. 是因为数据类型是dateTime吗?
  2. 我可以在不更改数据类型的情况下删除T.


 {
   "code": "Code",
   "date": "2018-05-02T20:02:24" //T
 },
Run Code Online (Sandbox Code Playgroud)

我的Web API中的代码

public IEnumerable<Result> MethodName()
{
   var result = (from x in Context.Tabl1
                 select new Result
                 {
                   Code = x.Code,
                   Date = x.Date,// I dont want to apply ToString(format)
                 }).ToArray();
}
Run Code Online (Sandbox Code Playgroud)

预期结果

 {
    "code": "Code",
    "date": "2018-05-02 20:02:24" //Without T
  },
Run Code Online (Sandbox Code Playgroud)

c# datetime json asp.net-web-api

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

如何在列表List <T,T2>中使用两种类型

我们可以List <T> 在类类型中使用两个不同的类型参数或者再添加一个参数吗?

例如:

public class ClassA
{
 public int a {get;set;}
 public int b {get;set;}
}
Run Code Online (Sandbox Code Playgroud)

我需要列表中的更多属性而不编辑ClassA

public string c {get;set;}

public List<ClassA, c> list = new List<ClassA, c>
Run Code Online (Sandbox Code Playgroud)

我应该能够访问List中的c

item[0].a
item[0].b
item[0].c
Run Code Online (Sandbox Code Playgroud)

c# generics

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