小编h.a*_*lex的帖子

nhibernate queryover使用where-or子句加入别名

我只是发布代码:

public IList<Dish> GetByNameDishTypes(IEnumerable<string> names,
    IEnumerable<string> dishTypes)
{
    // return dishes (ie food) whose name is in the names enumerable,
    // or whose type is in the dish types enumerables
    // (this would be 'breakfast', 'dinner') ..

    var namesArr = names != null ? names.ToArray() : new string[0];
    var dishTypesArr = dishTypes != null ? dishTypes.ToArray() : new string[0];

    var criteria = this.Session.CreateCriteria<Dish>();
    criteria.CreateAlias("DishType", "dt");
    criteria.Add(
        Restrictions.Or
        (
            Restrictions.In("Name", namesArr),
            Restrictions.In("dt.Name", dishTypesArr)
        ));

    return criteria.List<Dish>();

    /* get this to work? …
Run Code Online (Sandbox Code Playgroud)

nhibernate alias join queryover

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

wpf 窗口(ui)被长时间渲染操作阻塞 - 可以使用后台线程进行渲染吗?

当渲染操作处于活动状态时,应用程序窗口会阻塞。即当设置了 ContentControl 的 Content 属性时。绘制一个用户控件,它是内容的 DataTemplate。冻结持续 5 到 10 秒,具体取决于所使用的 PC。

这个用户控件并不太复杂(大约 250 个简单控件 - 图像、文本框、文本块、按钮等)。布局远非完美,我没有写它,我既没有时间,也不想优化布局,因为问题最多可以减少。

我能够完成的最好的事情是将控件包装在一个“容器”中,该容器能够在 ui/app 窗口冻结之前绘制加载动画并显示繁忙的光标。我在下面给出了一个完整的代码清单。

我在代码中注释了“冻结从此处开始”,位于包装器自定义控件代码中问题的底部。这就是 WPF 渲染引擎开始绘制用户控件(即其中的网格)的时候。

我经常使用我最喜欢的搜索引擎,我了解到 WPF 有一个特殊的“渲染”线程,它与 UI 线程是分开的。

其他的是在冻结时隐藏应用程序窗口并在此期间显示“加载”动画窗口(或此期间的某些衍生物),鉴于下面的代码,这很容易但很荒谬 - 有没有办法减轻这种情况?

这是代码,首先是用例:

<!-- while I am being rendered, I block the UI thread. -->
<UserControl x:Class="MyUserControl"
             xmlns:loading="clr-namespace:Common.UI.Controls.Loading;assembly=Common.UI.Controls">    
    <loading:VisualElementContainer>
        <loading:VisualElementContainer.VisualElement>
            <Grid>
                <!-- some 500 lines of using other controls with binding, templates, resources, etc.. 
                for the same effect try having a canvas with maaany rectangles..-->
            </Grid>
        </loading:VisualElementContainer.VisualElement>
    </loading:VisualElementContainer>    
</UserControl>
Run Code Online (Sandbox Code Playgroud)

包装器自定义控件布局:

<Style TargetType="{x:Type …
Run Code Online (Sandbox Code Playgroud)

c# wpf rendering renderer dispatcher

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

EF 6数据库首先使所有属性在生成的实体类中虚拟化

我有一个db第一个edmx模型.它生成的部分类具有非虚拟简单属性.例如

//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated from a template.
//
//     Manual changes to this file may cause unexpected behavior in your application.
//     Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

    public partial class Entity
    {
     public int Id {get;set;} //not virtual
     public string SomeOtherProperty {get;set;} //also not virtual
     public virtual ICollection<RelatedEntity> RelatedCollection {get;set;} //but 'navigational' properties are virtual.
    }
Run Code Online (Sandbox Code Playgroud)

如何告诉设计师将所有属性虚拟化?

c# virtual entity-framework properties

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

减少Workflow Foundation项目的构建时间

我正在开发一个WF项目,其中包含许多进程和代码活动.该项目建设时间过长(比解决方案中的任何其他项目多20-30倍).

我已经向谷歌询问了这一点,但似乎没有任何信息.

请问,如何减少Workflow Foundation项目的构建时间?

performance build visual-studio workflow-foundation-4

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