小编Saa*_*aab的帖子

突出显示jQuery UI自动完成功能

我在jQuery UI 1.8.6中使用自动完成功能.我想强调匹配的结果.但由于某些原因,当我使用正则表达式在匹配的字符周围添加"强"标签时,字符串将被转义.所以我看到了[strong]matching chars[/strong],而不是标记文字.

这是我目前正在使用的javascript:

$("#autocompleteinputfield").autocomplete({
    source: function (request, response) {
        $.ajax({
            url: "someservice",
            type: "GET",
            dataType: "json",
            data: { filter: request.term, maxResults: 10 },
            success: function (data) {
                response($.map(data, function (item) {
                    // return { label: item.ID + ' - ' + item.Name, id: item.ID, value: item.Name }
                    var regex = new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + request.term.replace(/ ([\^\$\(\)\[\]\{\}\*\.\+\?\|\\])/ gi, "\\$1") + ")(?![^<>]*>)(?![^&;]+;)", "gi");

                    return {
                        label: (item.ID + ' - ' + item.Name).replace(regex, "<strong>$1</strong>"),
                        id: item.ID,
                        value: item.Name
                    } …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui

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

为什么EF4 Code First在存储对象时如此之慢?

我目前正在研究如何在我的Web应用程序中使用db4o存储.我很高兴db4o的工作原理.因此,当我阅读Code First方法时,我有点喜欢的是,因为使用EF4 Code First的方式与使用db4o非常相似:创建域对象(PO​​CO),将它们抛到db4o,永不回头.

但是当我进行性能比较时,EF 4的速度非常慢.我无法弄清楚原因.

我使用以下实体:

public class Recipe { private List _RecipePreparations; public int ID { get; set; } public String Name { get; set; } public String Description { get; set; } public List Tags { get; set; } public ICollection Preparations { get { return _RecipePreparations.AsReadOnly(); } }

    public void AddPreparation(RecipePreparation preparation) 
    {
        this._RecipePreparations.Add(preparation);
    }
}
Run Code Online (Sandbox Code Playgroud)

public class RecipePreparation {public String Name {get; 组; } public String Description {get; 组; } public int Rating {get; 组; …

Run Code Online (Sandbox Code Playgroud)

c# db4o entity-framework

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

将代理设置设置为"使用自动配置脚本"的WCF客户端

我目前正在开发一个需要与互联网上的Web服务进行通信的应用程序.Internet Explorer直到知道通过代理服务器连接到Internet的唯一应用程序.

代理设置设置为"使用自动配置脚本".

我保留了默认设置

<binding useDefaultWebProxy="true" />
Run Code Online (Sandbox Code Playgroud)

另外设置

<security mode="TransportCredentialOnly">
        <transport clientCredentialType="Windows" proxyCredentialType="Basic"
          realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
Run Code Online (Sandbox Code Playgroud)

但没有运气.我一直在"(407)需要代理身份验证".

我做了一些谷歌,但解决方案似乎不适合我的情况.

简短更新:应用程序应使用默认用户凭据运行,并通过NTLM使用这些凭据对代理进行身份验证.但即使我设置客户端这样做,它似乎没有帮助.

c# wcf wcf-binding

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

摘要远离自定义指令中的传单指令

我目前正在研究使用ngx-leaflet来使用传单的Angular 6应用程序.我们希望能够创建一个可以通过向其添加指令来自定义的基本组件.基本上与使用leafletDraw使用绘图功能时使用的模式相同.但是这些指令应该比传单和leafletDraw指令更抽象.

目前我们最终得到了我们的"基础组件"中使用的以下模板

<div class="map" leaflet [leafletOptions]="options" [leafletLayers]="layers" [leafletOptions]="options" leafletDraw [leafletDrawOptions]="drawOptions" poiSelection [poiSelectionOptions]="selectionOptions"
poiSelection [trackPlaybackOptions]="trackOptions">
</div>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,这可能最终导致不同抽象级别的指令.

我宁愿这样:

<app-our-nice-map poiSelection [poiSelectionOptions]="selectionOptions" [trackPlaybackOptions]="trackOptions">
</app-our-nice-map>
Run Code Online (Sandbox Code Playgroud)

而OurNiceMapComponent组件的模板如下所示:

<div class="map" leaflet [leafletOptions]="options" [leafletLayers]="layers" [leafletOptions]="options">
</div><!-- this is here because Stackoverflow doesn't like single div /-->
Run Code Online (Sandbox Code Playgroud)

这有两个挑战.

  1. 找到一个关于更高级别指令如何与更低级别指令(leafletDraw)进行交互/配置(poiSelection)的方法.
  2. 如何动态添加指令.正如您在上面的OurNiceMapComponent模板中所看到的,我没有添加leafletDraw,因为它仅由特定的更高级别指令使用.

所以问题是,如何创建这些"更高阶指令".

angular ngx-leaflet

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

为什么不是基于参数类型调用的最具体的方法

总OO noob问题在这里.我在课堂上有这两种方法

private void StoreSessionSpecific(LateSession dbSession, SessionViewModel session)
{
    session.LateSessionViewModel.Guidelines = dbSession.Guidelines.ToList();
}

private void StoreSessionSpecific(Session dbSession, SessionViewModel session )
{
        // nothing to do yet...
}
Run Code Online (Sandbox Code Playgroud)

当我调用StoreSessionSpecific时,dbSession的类型为LateSession(LateSession继承Session)

var dbSession = new LateSession();
StoreSessionSpecific(dbSession, session);
Run Code Online (Sandbox Code Playgroud)

我期待最高的一个被召唤.由于dbSession属于LateSession类型.

@Paolo Tedesco这是类的定义方式.

public class Session
{
    public int ID { get; set; }
    public int SessionTypeId { get; set; }
    public virtual SessionType SessionType { get; set; }
    [Required]
    public DateTime StartTime { get; set; }
    [Required]
    public DateTime EndTime { get; set; } …
Run Code Online (Sandbox Code Playgroud)

c# oop polymorphism overloading

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

用于标记多种类型实体的数据库设计

我目前正在设计一个用于存储食谱的数据库模式.在这个数据库中,我希望能够标记不同类型的实体(成分,配方发布者,食谱等).所以标签有多个n:m关系.如果我使用"三表设计",这将导致我拥有的每种实体类型(食谱,配料,发行人)的表(交叉表).换句话说,每次我介绍一个实体时,我都要为它添加一个交叉表.

我正在考虑创建一个具有唯一ID的表,所有实体都引用该表,并且在tags表和"unique id"-table之间建立:m关系.这样,"unique id"-table和tag表之间只有一个交叉表.

以防万一有人会认为这个问题已被提出.我已经阅读了数据库设计标记.并且提到了三种表格设计.

tagging database-design

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

ASP.NET MVC3将REST服务路由到控制器

我想以下列方式路由REST服务URL:

/User/Rest/ -> UserRestController.Index()
/User/Rest/Get -> UserRestController.Get()

/User/ -> UserController.Index()
/User/Get -> UserController.Get()
Run Code Online (Sandbox Code Playgroud)

所以基本上我在网址中为Rest做了一个硬编码的例外.

我对MVC路由不是很熟悉.那么实现这一目标的好方法是什么?

c# asp.net url-routing asp.net-mvc-3

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

'AsyncEnumerableReader' 达到了配置的最大大小,但未使用 AsyncEnumerable

我正在使用 EF Core 3.1.1(dotnet core 3.1.1)。我想返回大量的 Car 实体。不幸的是,我收到以下错误消息:

'AsyncEnumerableReader' reached the configured maximum size of the buffer when enumerating a value of type 'Microsoft.EntityFrameworkCore.Internal.InternalDbSet`...
Run Code Online (Sandbox Code Playgroud)

我知道还有另一个关于相同错误的已回答问题。但我没有做显式的异步操作。

[HttpGet]
[ProducesResponseType(200, Type = typeof(Car[]))]
public IActionResult Index()
{
   return Ok(_carsDataModelContext.Cars.AsEnumerable());
}
Run Code Online (Sandbox Code Playgroud)

_carDataModelContext.Car 只是一个简单的实体,将一对一映射到数据库中的表。 public virtual DbSet<Car> Cars { get; set; }

原来我回来Ok(_carsDataModelContext.Cars.AsQueryable())是因为我们需要支持OData。但为了确保不是 OData 把事情搞砸了,我尝试返回 AsEnumerable,并从方法中删除“[EnableQuery]”属性。但这仍然以相同的错误结束。

解决这个问题的唯一方法是,如果我回来 Ok(_carsDataModelContext.Cars.ToList())

c# entity-framework-core .net-core

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