我很新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) 我必须Employee根据他们进行过滤department。我可以使用LINQ进行相同的操作。
Linq并lambda编译以得到相同的结果。编译器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) 我试图使用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) 我需要在我的视图模型中使用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的新手.
任何帮助表示赞赏
这是我用来创建演示文稿的代码。
我在这里尝试的是创建一张幻灯片并将形状插入其中并将幻灯片附加到已创建的演示文稿中。这很好用。
我的问题是如何设置插入幻灯片的布局。我的意思是这里的幻灯片布局是
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) 我希望使用 AzureDevOps 作为我的 CI/CD 工具来启用我的项目 (asp.net api) CI/CD。
我希望通过 FTP 将我发布的文件上传到我的托管提供商。
目前,当通过 Azure DevOps 构建产品时,它会将应用程序创建为 Msdeploy 文件。我的托管提供商不支持通过 ftp
建造
正如您所看到的构建工件,其格式为 Web 部署
上传文件后,服务器不知道如何部署 msdeploy 项目文件。 如何使用 AzureDevOps 部署网站
我想将文件作为 ftp 支持的常规文件上传,或者我想以自动方式执行 msdeploy
为什么我的Json DateTime值在时间之前有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) 我们可以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# ×6
asp.net-mvc ×1
async-await ×1
azure-devops ×1
datetime ×1
ftp ×1
generics ×1
json ×1
lambda ×1
linq ×1
msdeploy ×1
mvvm ×1
mvvm-light ×1
nest ×1
openxml ×1
openxml-sdk ×1
powerpoint ×1
presentation ×1
publishing ×1
wpf ×1