views:

25

answers:

0

I'm working on creating my own Linq-to-Sql generated classes in order to learn the concepts behind it all.

I have some questions, if anyone knows the answer to one or more of these I'd be much obliged.

The code below, and thus the questions, are from looking at code generated by creating a .DBML file in the Visual Studio 2010 designer, and inspecting the .Designer.cs file afterwards.

1. Why is INotifyPropertyChanging not passing the property name

The event raising method is defined like this:

protected virtual void SendPropertyChanging()

Why isn't the name of the property that is changing passed to the event here? It is defined to be part of the EventArgs descendant that is passed to the event handler, but the method only passes an empty such value to it.

2. Why are the EntitySet<X> attach/detach methods not raising property changed?

For an EntitySet<X> reference, the following two methods are generated:

private void attach_EmailAddress1s(EmailAddress1 entity)
{
    this.SendPropertyChanging();
    entity.Person1 = this;
}

private void detach_EmailAddress1s(EmailAddress1 entity)
{
    this.SendPropertyChanging();
    entity.Person1 = null;
}

Why isn't SendPropertyChanged also called here?

I'm sure I have more questions later, but for now these will suffice :)