小编Ada*_*dam的帖子

实体框架..部分构造函数

我打算扩展我的Entity Framework中的一些实体的构造函数(4).

但是,如何确保在模型运行后运行构造函数.即我想在我的构造函数中处理它之前确保该对象保存数据库中的数据.

c# entity-framework partial-classes

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

WPF数据绑定到通用List <>

我做错了什么......你知道它是怎么回事.

我试过使用ItemsSource,DataContext,DisplayMemberPath和SelectedValuePath,我得到一个空白的列表,列出了在Person对象中调用的ToString方法;

真正需要帮助的是某人发布适用于此示例的答案.

我已经简化了问题,因为我在使用数据绑定泛型方面遇到了困难.

我创建了一个简单的通用人员列表,并希望将其绑定到组合.(也想尝试使用ListView).

我得到一个空格列表或'xxxx.Person'列表,其中xxxx =名称空间

       <Window x:Class="BindingGenerics.MainWindow"
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                Title="MainWindow" Height="300" Width="300">
            <Grid>

                <ComboBox Name="ComboBox1"
                          ItemsSource="{Binding}"
                          Height="50"
                          DisplayMemberPath="Name"
                          SelectedValuePath="ID"
                          FontSize="14"
                          VerticalAlignment="Top">
                </ComboBox>

            </Grid>
        </Window>



using System.Windows;
using System.ComponentModel;

namespace BindingGenerics
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();

            Person p = new Person();
            // I have tried List and BindingList
            //List<Person> list = new List<Person>();
            BindingList<Person> list = new BindingList<Person>();

            p.Name = "aaaa";
            p.ID = …
Run Code Online (Sandbox Code Playgroud)

wpf binding wpf-controls

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

日志。单例并调用类/方法/线程

只是想加快速度。

2个问题..

我的意图是有一个单例类,使 NLog 可用于整个应用程序......这是正确的方法。

我如何在日志中记录条目的来源,即类..方法..线程等。

logging nlog

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