Skip to content

Instantly share code, notes, and snippets.

@jfromaniello
Created May 3, 2010 17:50
Show Gist options
  • Save jfromaniello/388368 to your computer and use it in GitHub Desktop.
Save jfromaniello/388368 to your computer and use it in GitHub Desktop.
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using Northwind.Domain;
namespace Northwind.Domain.Entities
{
[Serializable]
public partial class CustomerCustomerDemo : EntityBase<CustomerCustomerDemoCompositeID>
{
public CustomerCustomerDemo()
{
ID = new CustomerCustomerDemoCompositeID();
Initialize();
}
partial void Initialize();
public virtual CustomerDemographic CustomerDemographics
{
get
{
return ID.CustomerDemographics ;
}
set
{
if( ID.CustomerDemographics != value )
{
ID.CustomerDemographics = value;
OnPropertyChanged("CustomerDemographics");
}
}
}
public virtual Customer Customers
{
get
{
return ID.Customers ;
}
set
{
if( ID.Customers != value )
{
ID.Customers = value;
OnPropertyChanged("Customers");
}
}
}
}
}
##########################
using System;
namespace Northwind.Domain.Entities
{
public class CustomerCustomerDemoCompositeID : BaseCompositeID
{
private CustomerDemographic _customerdemographic;
private Customer _customer;
public virtual CustomerDemographic CustomerDemographic
{
get
{
return _customerdemographic;
}
set
{
if( _customerdemographic != value )
{
_customerdemographic = value;
OnPropertyChanged("CustomerDemographic");
}
}
}
public virtual Customer Customer
{
get
{
return _customer;
}
set
{
if( _customer != value )
{
_customer = value;
OnPropertyChanged("Customer");
}
}
}
public override bool Equals( object obj )
{
if ( obj == null )
return false;
if ( obj == this )
return true;
CustomerCustomerDemoCompositeID that = obj as CustomerCustomerDemoCompositeID;
if ( that == null )
return false;
if ( !this.CustomerDemographic.Equals( that.CustomerDemographic ) )
return false;
if ( !this.Customer.Equals( that.Customer ) )
return false;
return true;
}
public override int GetHashCode()
{
return this.CustomerDemographic.GetHashCode()+this.Customer.GetHashCode();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment