我正在玩Entity Framework 4.3,所以我使用DbContext Generator来创建上下文和实体类.
使用默认的EF 4代码生成器模板,实体类实现INotifyPropertyChanged,还可以在属性设置器中添加Changing和Changed部分方法.
当我使用EF 4.x DbContext生成器时,如下图所示,实体类更轻,并且不包括任何跟踪属性更改的方法.

这是一个例子:
//------------------------------------------------------------------------------
// <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>
//------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
namespace SomeNamespace
{
public partial class SomeTable
{
public SomeTable()
{
this.Children = new HashSet<Child>();
}
public long parent_id { …Run Code Online (Sandbox Code Playgroud) 我正在研究WPF MVVM应用程序.我注意到的是,我必须编写过多的样板代码来声明命令(通过WPF Team的MVVM Toolkit中的DelegateCommands),附加属性和附加行为.有没有可用的策略来减少我必须编写的样板代码的数量?
谢谢!