Microsoft Developer Network >
Forums Home
>
Archived Forums Forums
>
LINQ Project General
>
EntitySet<T>
EntitySet<T>
I can't find the EntitySet<T> in the programming environment,
and I don't know how use it.
Who can help me ?
thanks.
Answers
- EntitySet<T> is part of LINQ to SQL, it is in the namespace System.Data.Linq and in the assembly System.Data.Linq.dll.
As for using it, normally you let Visual Studio generate a .NET represenation of your data base; that way you have classes representing the tables in your database where properties of type EntitySet<T> represent relationships between tables. Below is an example of a class Customer representing a table Customers; each Customer has a property Orders of type EntitySet<Order> representing a relationship between the Customers and the Orders table.
[Table(Name = "Customers")] public partial class Customer { [Column(IsPrimaryKey = true)] public string CustomerID; // ... private EntitySet<Order> _Orders; [Association(Storage = "_Orders", OtherKey = "CustomerID")] public EntitySet<Order> Orders { get { return this._Orders; } set { this._Orders.Assign(value); } } }
MVP XML My blog- Marked As Answer byHarry ZhuMSFT, ModeratorFriday, November 13, 2009 4:45 AM
All Replies
- EntitySet<T> is part of LINQ to SQL, it is in the namespace System.Data.Linq and in the assembly System.Data.Linq.dll.
As for using it, normally you let Visual Studio generate a .NET represenation of your data base; that way you have classes representing the tables in your database where properties of type EntitySet<T> represent relationships between tables. Below is an example of a class Customer representing a table Customers; each Customer has a property Orders of type EntitySet<Order> representing a relationship between the Customers and the Orders table.
[Table(Name = "Customers")] public partial class Customer { [Column(IsPrimaryKey = true)] public string CustomerID; // ... private EntitySet<Order> _Orders; [Association(Storage = "_Orders", OtherKey = "CustomerID")] public EntitySet<Order> Orders { get { return this._Orders; } set { this._Orders.Assign(value); } } }
MVP XML My blog- Marked As Answer byHarry ZhuMSFT, ModeratorFriday, November 13, 2009 4:45 AM

