Hi nauna,
Refer below sample.
Namespaces
C#
using NorthwindModel;
using System.Data.Objects;
VB.Net
Imports NorthwindModel
Imports System.Data.Objects
Code
C#
DataAccessCS.cs
public object GetList()
{
NorthwindEntities entity = new NorthwindEntities();
var customersList = (from result in entity.Customers
select result).Distinct();
return customersList;
}
CS.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
DataAccess access = new DataAccess();
List<Customer> list = ((ObjectQuery<Customer>)access.GetList()).ToList();
}
VB.Net
DataAccessVB.vb
Public Function GetList() As Object
Dim entity As NorthwindEntities = New NorthwindEntities()
Dim customersList = (From result In entity.Customers Select result).Distinct()
Return customersList
End Function
VB.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim access As DataAccessVB = New DataAccessVB()
Dim list As List(Of Customer) = (CType(access.GetList(), ObjectQuery(Of Customer))).ToList()
End Sub
Screenshot