ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Common Method or Function return Linq query result in Entity Framework<p>Hi&nbsp;nauna,</p> <p>You can create a method that will return&nbsp;Anonymous types as an object.</p> <p>Check this example. Now please take its reference and correct your code.</p> <p><strong><span style="text-decoration: underline;">Database</span></strong></p> <p>For this example I have used of Northwind database that you can download using the link given below.</p> <p><a href="https://www.aspsnippets.com/Articles/Install-Microsoft-Northwind-and-Pubs-Sample-databases-in-SQL-Server-Management-Studio.aspx" target="_blank">Download Northwind Database</a></p> <p><strong><span style="text-decoration: underline;">C#</span></strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { var employee = GetEmployees(); } private object GetEmployees() { NorthwindEntities entities = new NorthwindEntities(); var q = from emp in entities.Employees select emp; return q; }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim employee = GetEmployees() End Sub Private Function GetEmployees() As Object Dim entities As NorthwindEntities = New NorthwindEntities() Dim q = From emp In entities.Employees Select emp Return q End Function</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/174842/Common-Method-or-Function-return-Linq-query-result-in-Entity-Framework/https://www.aspforums.net:443/Threads/174842/Common-Method-or-Function-return-Linq-query-result-in-Entity-Framework/Tue, 11 Jun 2019 05:10:05 GMT