Note that there are some explanatory texts on larger screens.

plurals
  1. POReading values from DBML(having stored procedure)
    text
    copied!<p>I have a dbml that has stored procedures dragged off.I have EmployeeModel class that has get and set propertise .</p> <p>I have an interface IEmployee and a Repository Employee Repository that has the implementation of the methods.Please refer the code.In Stored procedure GetRoles i just have SELECT * FROM ROLE .</p> <p>In repository how to loop through the resultset.Can i change ISingleResult to IMultipleResult in dbml designer file?</p> <p>EmployeeModel.cs:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MvcWebsite.Models { public class EmployeeModel { public int RoleId { get; set; } public string RoleName { get; set; } public string Description { get; set; } public string TaskMark { get; set; } public int RoleFlag { get; set; } } } </code></pre> <p>IEmployee:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Text; using MvcWebsite.Models; namespace MvcWebsite.DAL { public interface IEmployees { IList&lt;EmployeeModel&gt; ListAll(); // void Save(EmployeeModel employ); } } </code></pre> <p>EmployeeRepository.cs:</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using MvcWebsite.Models; using System.Data.Linq; namespace MvcWebsite.DAL { public class EmployeeRepository:IEmployees { private DataDataContext _dataContext; public EmployeeRepository() { _dataContext = new DataDataContext(); } public IList&lt;EmployeeModel&gt; ListAll() { //IMultipleResults result =_dataContext.GetRoleDetails(); //var Emps = result.GetResult(EmployeeModel); List&lt;EmployeeModel&gt; emp = _dataContext.GetRoleDetails(); // foreach (GetRoleDetailsResult role in Emps) // { // role.Description=Emps. // } return Emps.ToList(); } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload