• OneToMany: Means one instance of the current object to many instances of the type in the relational attribute, for example:

	     //This is the Customer class
        [OneToMany(typeof(CustomerOrders), RelationColumn = "CustomerId")]
        public virtual IList<CustomerOrders> CustomerOrders
        {
            get;
            set;
        }

The code above states that One instace of the Customer class to many instances of the CustomerOrders class. So the value “CustomerId” assigned to the RelationColumn is a column in the CustomerOrders table which is a foreign key to the Customer table, that happens to be the Customers primary key.

Last edited Feb 23, 2010 at 1:32 PM by ahmedsalako, version 2

Comments

No comments yet.