LINQ samples

To use LINQ need

Imports System.Linq
May need reference to System.Core and System.Data
‘LINQ
Dim MRU As IEnumerable(Of PadMain) = From pm In mruList OrderBy pm.PadMaterial

LINQ to Entity Framework

Private
context As BC.SWT.EntityModel.SOPEntities

Dim EntityConnectionString = Configuration.ConfigurationManager.ConnectionStrings(“SOPEntities”).ConnectionString
context = New BC.SWT.EntityModel.SOPEntities(EntityConnectionString)

Dim
CustomerQuery AsObjectQuery(OfCustomer) = context.Customers
Dim results = From a In CustomerQuery Select a.CustomerID, a.Customer1 OrderBy Customer1

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: